简体   繁体   English

如何增加在IIS7中运行的Web服务的超时时间?

[英]How can I increase the timeout for web service running in IIS7?

I have a webservice (.asmx) method that takes several minutes to complete. 我有一个webservice(.asmx)方法,需要几分钟才能完成。 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 我尝试将以下内容添加到我的web.config中

<system.web>
<httpRuntime executionTimeout="1200"/>

MSDN documentation says that this should increase the timeout by seconds. MSDN文档说,这应该将超时增加几秒钟。 The time out is occurring quicker than 20 minutes. 超时发生的时间超过20分钟。

Can someone help? 有人可以帮忙吗?

Thanks! 谢谢!

Tha application pool recycles every 20 minutes by default. 默认情况下,应用程序池每20分钟回收一次。

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. 如果您要构建永久使用的文件或报告,请考虑在Windows服务的后台构建它,并在准备就绪时向用户发送电子邮件。

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. 如果您提供更多信息,我将更新我的答案。

You also should change: 您还应该更改:

<system.web>
    <sessionState timeout="..." />
</system.web>

And also configure the application pool timeout, as David Lively said. 并配置应用程序池超时,如David Lively所说。 This can be done in IIS manager. 这可以在IIS管理器中完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM