ASP.NET Core MVC請求超時設置解決方案

設置請求超時解決方案

當進行數據導入時,若導入數據比較大時此時在ASP.NET Core MVC會出現502 bad gateway請求超時狀況(目前對於版本1.1有效,2.0未知),此時咱們須要在項目web.config配置文件中進行以下設置便可:web

<?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>

咱們須要如上設置 requestTimeout 屬性便可解決問題。spa

相關文章
相關標籤/搜索