设置超时值.NET Web服务NET、Web

2023-09-02 10:28:38 作者:一直想去有你的未来

我在C#编写的是生活在SharePoint网站上的Web服务。我已经修改了web.config中有以下code:

I have a web service written in C# that is living on a SharePoint site. I have modified the web.config with the following code:

<configuration>
  <system.web>
    <httpRuntime executionTimeout="360" />

...

对于IIS的Inetpub文件时,SP ISAPI web.config文件和SP布局的web.config。我还修改了machine.config文件具有相同code,并试图撞击,我在IIS中看到任何超时。

for the IIS Inetpub file, the SP ISAPI web.config file and the SP layouts web.config. I have also modified the machine.config file with the same code and tried to bump any timeouts that I see in IIS.

当我称之为从Windows C#应用程序此Web服务,我可以进入网络的方法,并开始调试变量,但在很短的时间(约1分钟后,也许更少)变量的值不再是present因为这得到返回的:

When I call this web service from a Windows C# application I can step into the web method and start debugging the variable but after a short time (~1 minute, maybe less) the variable values are no longer present because this gets returned:

System.Net.WebException请求已中止:操作超时

System.Net.WebException "The request was aborted: The operation has timed out."

我试图找出其中正确的超时值需要设置以及如何。我重新启动IIS后,我已经尽了一切的改变,但没有改变得到不同的结果。

I am trying to figure out where the correct timeout values needs to be set and how. I restart IIS after I have made every change but nothing changes to give different results.

感谢

推荐答案

尝试设置超时值在Web服务代理类:

Try setting the timeout value in your web service proxy class:

WebReference.ProxyClass myProxy = new WebReference.ProxyClass();
myProxy.Timeout = 100000; //in milliseconds, e.g. 100 seconds