[英]How to increase request timeout in IIS?
How to increase request timeout in IIS 7.0?如何在 IIS 7.0 中增加请求超时? The same is done under application tab in ASP configuration settngs in IIS 6.0.
在 IIS 6.0 中的 ASP 配置设置中的应用程序选项卡下也是如此。 I am not able to find the asp.net configuration section in IIS 7.0
我在 IIS 7.0 中找不到 asp.net 配置部分
Add this to your Web Config将此添加到您的 Web 配置
<system.web>
<httpRuntime executionTimeout="180" />
</system.web>
https://msdn.microsoft.com/en-us/library/e1f13641(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/e1f13641(v=vs.85).aspx
Optional TimeSpan attribute.
可选的 TimeSpan 属性。
Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET.
指定请求在被 ASP.NET 自动关闭之前允许执行的最大秒数。
This time-out applies only if the debug attribute in the compilation element is False.
仅当编译元素中的 debug 属性为 False 时,此超时才适用。 To help to prevent shutting down the application while you are debugging, do not set this time-out to a large value.
为帮助防止在调试时关闭应用程序,请勿将此超时设置为较大的值。
The default is "00:01:50" (110 seconds).
默认值为“00:01:50”(110 秒)。
In IIS Manager, right click on the site and go to Manage Web Site -> Advanced Settings .在 IIS 管理器中,右键单击该站点并转到Manage Web Site -> Advanced Settings 。 Under Connection Limits option, you should see Connection Time-out .
在Connection Limits选项下,您应该看到Connection Time-out 。
To Increase request time out add this to web.config要增加请求超时,请将其添加到 web.config
<system.web>
<httpRuntime executionTimeout="180" />
</system.web>
and for a specific page add this并为特定页面添加此
<location path="somefile.aspx">
<system.web>
<httpRuntime executionTimeout="180"/>
</system.web>
</location>
The default is 90 seconds for .NET 1.x. .NET 1.x 的默认值为 90 秒。
The default 110 seconds for .NET 2.0 and later. .NET 2.0 及更高版本的默认 110 秒。
In IIS >= 7, a <webLimits>
section has replaced ConnectionTimeout
, HeaderWaitTimeout
, MaxGlobalBandwidth
, and MinFileBytesPerSec
IIS 6 metabase settings.在 IIS >= 7 中,
<webLimits>
部分替换了ConnectionTimeout
、 HeaderWaitTimeout
、 MaxGlobalBandwidth
和MinFileBytesPerSec
IIS 6 元数据库设置。
Example Configuration:示例配置:
<configuration>
<system.applicationHost>
<webLimits connectionTimeout="00:01:00"
dynamicIdleThreshold="150"
headerWaitTimeout="00:00:30"
minBytesPerSecond="500"
/>
</system.applicationHost>
</configuration>
For reference: more information regarding these settings in IIS can be found here .供参考: 可在此处找到有关 IIS 中这些设置的更多信息。 Also, I was unable to add this section to the web.config via the IIS manager's "configuration editor", though it did show up once I added it and searched the configuration.
此外,我无法通过 IIS 管理器的“配置编辑器”将此部分添加到 web.config,尽管在我添加它并搜索配置后它确实出现了。
Below are provided steps to fix your issue.下面提供了解决问题的步骤。
I know the question was about ASP but maybe somebody will find this answer helpful.我知道这个问题是关于 ASP 的,但也许有人会发现这个答案有帮助。
If you have a server behind the IIS 7.5 (eg Tomcat).如果您在 IIS 7.5 后面有一个服务器(例如 Tomcat)。 In my case I have a server farm with Tomcat server configured.
就我而言,我有一个配置了 Tomcat 服务器的服务器场。 In such case you can change the timeout using the IIS Manager:
在这种情况下,您可以使用 IIS 管理器更改超时:
or you can change it in the cofig file:或者您可以在配置文件中更改它:
Example:例子:
<webFarm name="${SERVER_NAME}" enabled="true">
<server address="${SERVER_ADDRESS}" enabled="true">
<applicationRequestRouting httpPort="${SERVER_PORT}" />
</server>
<applicationRequestRouting>
<protocol timeout="${TIME}" />
</applicationRequestRouting>
</webFarm>
The ${TIME} is in HH:mm:ss format (so if you want to set it to 90 seconds then put there 00:01:30) ${TIME}采用HH:mm:ss格式(因此,如果您想将其设置为 90 秒,则将其设置为 00:01:30)
In case of Tomcat (and probably other servlet containers) you have to remember to change the timeout in the %TOMCAT_DIR%\\conf\\server.xml (just search for connectionTimeout attribute in Connector tag, and remember that it is specified in milliseconds )对于 Tomcat(可能还有其他 servlet 容器),您必须记住更改%TOMCAT_DIR%\\conf\\server.xml 中的超时(只需在Connector标记中搜索connectionTimeout属性,并记住它以毫秒为单位指定)
Use the below Power shell command to change the execution timeout (Request Timeout)使用以下 Power shell 命令更改执行超时(Request Timeout)
Please note that I have given this for default web site, before using these please change the site and then try to use this.
请注意,我已经为默认网站提供了这个,在使用这些之前,请更改网站,然后尝试使用它。
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/Default Web Site' -filter "system.web/httpRuntime" -name "executionTimeout" -value "00:01:40"
Or, You can use the below C# code to do the same thing或者,您可以使用下面的 C# 代码来做同样的事情
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample {
private static void Main() {
using(ServerManager serverManager = new ServerManager()) {
Configuration config = serverManager.GetWebConfiguration("Default Web Site");
ConfigurationSection httpRuntimeSection = config.GetSection("system.web/httpRuntime");
httpRuntimeSection["executionTimeout"] = TimeSpan.Parse("00:01:40");
serverManager.CommitChanges();
}
}
}
Or, you can use the JavaScript to do this.或者,您可以使用 JavaScript 来执行此操作。
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST/Default Web Site";
var httpRuntimeSection = adminManager.GetAdminSection("system.web/httpRuntime", "MACHINE/WEBROOT/APPHOST/Default Web Site");
httpRuntimeSection.Properties.Item("executionTimeout").Value = "00:01:40";
adminManager.CommitChanges();
Or, you can use the AppCmd commands.或者,您可以使用 AppCmd 命令。
appcmd.exe set config "Default Web Site" -section:system.web/httpRuntime /executionTimeout:"00:01:40"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.