ASP.NET Core MVC 502 bad gateway 超時如何處理


在網頁程序運行需要較長時間運行的時候,ASP.NET Core MVC會出現502 bad gateway請求超時情況。一般默認的超時時間都比較短,我們需要在 web.config 中配置一下。其中 requestTimeout 屬性就是用來設置超時時長的。

服務器環境: Net Core 2.1.15

參考這篇文章: https://www.cnblogs.com/OpenCoder/p/10307882.html , 測試了一下,第三種方法在代碼里設置超時是沒有用的~~~

然后看第2種方法,看本地IIS Express的設定超時時間是23:00:00, 所以在服務器上也設置這個時間.

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM