长时间执行ASP.NET导致错误“The Server Request timed out”错误

如果你要在一个ASP.NET页面之上执行大数据的读取和显示,那么你就很可能接收到如下错误信息:

Server Error in '/' Application.
Request timed out.
Description: An unhandled exception occurred during the executionof the current web request. Please review the stack trace for moreinformation about the error and where it originated in thecode.
Exception Details: System.Web.HttpException: Request timedout.
Source Error: An unhandled exception was generated during theexecution of the current web request. Information regarding theorigin and location of the exception can be identified using theexception stack trace below.
Stack Trace: [HttpException (0x80004005): Request timedout.]

解决方法:

修改Web.Config或者Machine.Config文件中的配置即可!

<configuration>
<system.web>
<httpRuntime=20 executionTimeout="36000" />
</system.web>
</configuration>

Exception Details: System.Web.HttpException: Request timed out.

In .NET, there is an additional setting for this. The default script timeout is set to 90 seconds by the httpRuntime section of the machine.config file. You can change this setting to affect all applications on your site, or you can override the settings in your application-specific web.config as follows:

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

The .NET config files are usually stored in the folder C:\Windows\Microsoft.NET\Framework\[version]\Config where [version] is the version of the .NET Framework such as v1.1.4322. You may need to restart IIS for such changes to take effect.

httpRuntime Element (ASP.NET Settings Schema)

http://msdn.microsoft.com/en-us/library/e1f13641.aspx

你可能感兴趣的:(Web,.net,Microsoft,asp.net,asp)