小编sbr*_*sbr的帖子

如何在asp .net core 3.1中设置请求超时

  • 从 Visual Studio 中选择创建新项目。选择 ASP.NET Core 3.1
  • 在 IIS 中发布和托管
  • 增加上传文件大小此代码:
public void ConfigureServices(IServiceCollection services)
{
    services.Configure<IISServerOptions>(options =>
    {
        options.MaxRequestBodySize = 314572800;
    });

    services.AddControllersWithViews();
}
Run Code Online (Sandbox Code Playgroud)

和网络配置:

<security>
    <requestFiltering>
      <!-- This will handle requests up to 300MB -->
      <requestLimits maxAllowedContentLength="314572800" />
    </requestFiltering>
</security>
Run Code Online (Sandbox Code Playgroud)

以上正确适用,但默认超时为 2 分钟

如何增加 IIS 中托管的 ASP.NET Core 3.1 应用程序的超时时间?

注意:我的 web.config

<aspNetCore processPath="dotnet" arguments=".\AspCoreTestFileUpload.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
Run Code Online (Sandbox Code Playgroud)

对于 requestTimeout :不适用于进程内托管。对于进程内托管,模块等待应用程序处理请求。

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.1#attributes-of-the-aspnetcore-element

我必须使用进程内托管模型

iis publish request-timed-out asp.net-core

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net-core ×1

iis ×1

publish ×1

request-timed-out ×1