在Asp.net core 中如何设置请求超时的时长

在网页程序运行需要较长时间运行的是时候,ASP.NET Core MVC会出现502 bad gateway请求超时情况。一般默认的超时时间都比较短,我们需要在 web.config 中配置一下。其中 requestTimeout 属性就是用来设置超时时长的。解决方案来自云端网客

<?xml version="1.0" encoding="utf-8"?>
<configuration>
   <system.webServer>
     <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
        </handlers>
        <aspNetCore requestTimeout="00:20:00"  processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
    </system.webServer>
</configuration>
posted @ 2017-08-20 11:54  我们都是程序猿  阅读(1834)  评论(0编辑  收藏  举报