<span style="font-family: "Microsoft YaHei";"><system.web> <compilation debug="false" targetFramework="4.0" /> <!-- 设置为600秒 Server.ScriptTimeout = 600 --> <httpRuntime executionTimeout="600"/></system.web></span>方法三:设置HttpRuntimeSection.ExecutionTimeout 的值 (经测试,无效!!!不知如何使用!)https://msdn.microsoft.com/zh-cn/library/system.web.configuration.httpruntimesection.executiontimeout(VS.80).aspx
这个未确定 网站→高级设置:
一样未确定 应用程序池→高级设置:
注意:如果页面使用了 UpdatePanel,UpdatePanel 内部的请求分以下两种情况:
①设置的超时值 >=90秒,UpdatePanel 内部的请求超时值将变为 90 秒!
② 设置的超时值 <90秒,UpdatePanel 内部的请求超时值将变为 所设置的值!
下图Server.ScriptTimeout= 5 秒,点击UpdatePanel 内部的按钮,Thread.Sleep(20 * 1000) 秒,请求超时,但是页面看不到报错信息!
而点击UpdatePanel 外部的按钮,则会报如图1的 “请求超时”的错误信息!
下图Server.ScriptTimeout= 100 秒,点击UpdatePanel 内部的按钮,Thread.Sleep(95 * 1000)//停止95秒; 实际上到90秒就超时了(如下面第二图)而点击UpdatePanel 外部的按钮,Thread.Sleep(95 * 1000)//停止95秒 ,请求成功!
=======================================================================================================================全局超时时间
服务器上如果有多个网站,希望统一设置一下超时时间,则需要设置 Machine.config 文件中的 ExecutionTimeout 属性值。Machine.config 文件位于%SystemRoot%Microsoft.NETFramework\%VersionNumber%CONFIG目录中。
<httpRuntime executionTimeout="600" />
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。