如何在IIS 7.0中增加请求超时?在IIS 6.0中的ASP配置设置中的应用程序选项卡下完成相同的操作.我无法在IIS 7.0中找到asp.net配置部分
我在我的ASP.NET Core MVC视图页面中使用了ajax调用
MyView.cshtml
$.ajax({
processData: false,
contentType: false,
data: new FormData(this),
type: $(this).attr('method'),
url: $(this).attr('action'),
cache: false,
success: function (data) {
$('#mydiv).html(data);
$('#bootstrapModal).modal('show');
Run Code Online (Sandbox Code Playgroud)
控制器发布方法"
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> MyLongRunningMethod(MyViewModel viewModel)
{
await MyProcess.Longprocess1();
await MyProcess.Longprocess2();
await MyProcess.Longprocess3();
await MyProcess.Longprocess4();
return PartialView("_MyPartialPage");
}
Run Code Online (Sandbox Code Playgroud)
这有效,但只对长时间运行的过程有问题.在调试模式下,当进程花费的时间超过大约2分钟时,我收到以下错误
我理解这与过期超时有关
在以前版本的ASP.NET MVC中,您显然可以增加asp.net控制器操作的超时.
HttpContext.Current.Server.ScriptTimeout = 90000;
Run Code Online (Sandbox Code Playgroud)
然而,这不存在于 ASP.NET Core
我想增加特定asp.net控制器的调试和部署超时.
对于生产,我可以web.config通过将requestTimeout添加到现有的httpPlatform标记来全局设置它.例如10分钟
<httpPlatform requestTimeout="00:10:00" ....
Run Code Online (Sandbox Code Playgroud)
一个类似的问题被问到,但答案给出了使用CancellationToken但阅读它,它似乎不能帮助我超时.
ASP.NET 4?有没有一种方法来设置requestTimeout从C#,而不是需要来设置requestTimeout的web.config?
asp.net托管在IIS中
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore requestTimeout="00:00:04" processPath="dotnet" arguments=".\Foo.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
iis .net-core asp.net-core asp.net-core-webapi asp.net-core-2.0