服務(wù)器上如果有多個(gè)網(wǎng)站,希望統(tǒng)一設(shè)置一下超時(shí)時(shí)間,則需要設(shè)置 Machine.config 文件中的 ExecutionTimeout 屬性值。Machine.config 文件位于 %SystemRoot%/Microsoft.NET/Framework/%VersionNumber%/CONFIG/ 目錄中。例如:
<httPRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
單個(gè)站點(diǎn)超時(shí)時(shí)間Web.config配置文件中設(shè)置http請(qǐng)求運(yùn)行時(shí)間:
<system.web><httpRuntime maxRequestLength="102400" executionTimeout="720" /> </system.web>
這里設(shè)置的為720秒,前面的屬性maxRequestLength一般用于用戶上傳文件限制大小!默認(rèn)一般為4096 KB (4 MB)。
單個(gè)頁(yè)面請(qǐng)求超時(shí)時(shí)間對(duì)于單個(gè)頁(yè)面,可以使用Server.ScriptTimeout來(lái)設(shè)定超時(shí)。
Server.ScriptTimeout = 120;
注意:如果在Web.config里設(shè)置了debug屬性,例如:<compilation debug="true" targetFramework="4.0">此時(shí),ScriptTimeout會(huì)被忽略。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注