ASP.NET 超时设置

在做月末数据导入的时候,因为用户数据量较大,有10万条,而之前页面设计又没有更新页面状态的处理,因此页面最后都会报超时的错。

测试环境:

web.config的配置值如下:

 <compilation defaultLanguage="c#" debug="true">
 <httpRuntime maxRequestLength="51200" useFullyQualifiedRedirectUrl="true" executionTimeout="120" />//seconds
 <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" cookieless="false" timeout="2" />//minute


结果发现,excutionTimeout设置的值根本不管用,查看网上信息,发现当debug='true'时,excutionTimeout的值不起作用,将debug设成false,2分钟后页面报错如下:

将excutionTimeout设成无限大,发现当1个小时后,页面还是会报错,报错信息为“this page can't be displayed” ,但是后台进程还在执行。

页面设计时应该加个滚动条之类的,这样就不会出现类似的问题了

原文地址:https://www.cnblogs.com/NoteofEveryDay/p/5282604.html