如何增加 IIS7 中运行的 Web 服务的超时时间?
我有一个 Web 服务 (.asmx) 方法,需要几分钟才能完成。在客户端,我已将超时设置为无限:
services.Timeout = -1;
我如何在服务器上执行相同的操作?
我尝试将以下内容添加到我的 web.config
<system.web>
<httpRuntime executionTimeout="1200"/>
MSDN 文档中说这应该将超时增加几秒。超时时间快于 20 分钟。
有人可以帮忙吗?
谢谢!
I have a webservice (.asmx) method that takes several minutes to complete. At the client I have set the timeout to be infinte:
services.Timeout = -1;
How can I do the same at the server?
I have tried adding the following to my web.config
<system.web>
<httpRuntime executionTimeout="1200"/>
MSDN documentation says that this should increase the timeout by seconds. The time out is occurring quicker than 20 minutes.
Can someone help?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
默认情况下,应用程序池每 20 分钟回收一次。
老实说,如果您的请求需要很长时间,您应该研究其他方法。如果您正在构建一个需要很长时间的文件或报告,请考虑在 Windows 服务的后台构建它,并在准备就绪时向用户发送电子邮件。
更好的问题可能是:到底是什么花了这么长时间,以及如何优化它?
如果您提供更多信息,我会更新我的答案。
Tha application pool recycles every 20 minutes by default.
Honestly, if you have a request that takes that long, you should investigate other approaches. If you're building a file or a report that takes forever, consider building it in the background in a windows service, and emailing the user when it's ready.
A better question might be: what on earth is taking that long, and how can you optimize it?
I'll update my answer if you provide more information.
您还应该更改:
并配置应用程序池超时,如 David Lively 所说。这可以在 IIS 管理器中完成。
You also should change:
And also configure the application pool timeout, as David Lively said. This can be done in IIS manager.