为 .NET Web 服务设置超时值 [英] Setting Timeout Value For .NET Web Service
问题描述
我有一个用 C# 编写的 Web 服务,它存在于 SharePoint 网站上.我已经使用以下代码修改了 web.config:
<预><代码><配置><system.web><httpRuntime executionTimeout="360"/>...
对于 IIS Inetpub 文件、SP ISAPI web.config 文件和 SP 布局 web.config.我还使用相同的代码修改了 machine.config 文件,并尝试改变我在 IIS 中看到的任何超时.
当我从 Windows C# 应用程序调用此 Web 服务时,我可以进入 Web 方法并开始调试变量,但在很短的时间(约 1 分钟,可能更短)后,变量值不再存在,因为它被返回:
System.Net.WebException 请求被中止:操作已超时."
我想弄清楚需要在何处设置正确的超时值以及如何设置.完成所有更改后,我重新启动 IIS,但没有任何更改以产生不同的结果.
谢谢
在创建您的客户端指定绑定和端点地址后,您可以分配一个 OperationTimeout,
client.InnerChannel.OperationTimeout = new TimeSpan(0, 5, 0);
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" />
...
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.
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 "The request was aborted: The operation has timed out."
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.
Thanks
After creating your client specifying the binding and endpoint address, you can assign an OperationTimeout,
client.InnerChannel.OperationTimeout = new TimeSpan(0, 5, 0);
这篇关于为 .NET Web 服务设置超时值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!