长时间运行ASP.NET时IIS请求超时

运行长时间的操作时,我从IIS请求超时。在后台,我的ASP.NET应用程序正在处理数据,但是正在处理的记录数很大,因此该操作要花费很长时间。


但是,我认为IIS使会话超时。IIS或ASP.NET会话有问题吗?


神不在的星期二
浏览 854回答 3
3回答

www说

由于我只在WebForms应用程序的一个管理页面中进行了长时间处理,因此我使用了code选项。但是为了允许临时快速修复生产,我<location>在web.config 的标记中使用了config版本。这样,我的管理/处理页面有足够的时间,而最终用户的页面等却保留了他们的旧时间行为。下面,我为您提供了需要同样快速修复的Googlers配置。你应该ofcourse使用其他值比我的'4小时的例子,但DO注意到,本次会议timeOut是在几分钟内,而要求executionTimeout是在几秒钟!而且-因为已经是2015年-对于非快速修复,您应该尽可能使用.Net 4.5的async / await,而不是现在的.NET 2.0的ASYNC页面,这是KEV在2010年回答时的最新情况:)。<configuration>&nbsp; &nbsp; ...&nbsp;&nbsp; &nbsp; <compilation debug="false" ...>&nbsp; &nbsp; ... other stuff ..&nbsp; &nbsp; <location path="~/Admin/SomePage.aspx">&nbsp; &nbsp; &nbsp; &nbsp; <system.web>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <sessionState timeout="240" />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <httpRuntime executionTimeout="14400" />&nbsp; &nbsp; &nbsp; &nbsp; </system.web>&nbsp; &nbsp; </location>&nbsp; &nbsp; ...</configuration>

梦里花落0921

我将其发布在这里,因为我在上面花了3到4个小时,而我只找到了与上述回答类似的答案,说确实添加了executionTime,但在这种情况下并不能解决问题您正在使用ASP .NET Core。为此,这将起作用:在web.config文件中,requestTimeout在aspNetCore节点上添加属性。<system.webServer>&nbsp; <aspNetCore requestTimeout="00:10:00" ... (other configs goes here) /></system.webServer>在此示例中,我将值设置为10分钟。
打开App,查看更多内容
随时随地看视频慕课网APP