今天更新网站突然发现上传文件超时了,那么asp.net core mvc 网站超时设置是怎么样的.

 设置代码如下

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore requestTimeout="00:30:00"  processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
  </system.webServer>
</configuration>

上面这代码是设置请求超时时间为30分钟.

那如果是在自己调试的机子呢?也很简单,代码如下:

public static IWebHost BuildWebHost(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
    .UseStartup<Startup>()
    .UseKestrel(option =>
    {
        option.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(30);
        option.Limits.RequestHeadersTimeout = TimeSpan.FromMinutes(30);
    })
    .Build();

上面这个方法在Program.cs里面.

以上就是【asp.net core mvc 网站超时设置】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)
发表我的评论

最新评论

  1. 暂无评论