When the page takes a long time to run to run, ASP.NET Core MVC will be 502 bad gateway request timeout. General default timeout relatively short, we need to configure it in web.config. Wherein the long time requestTimeout property is used to set a timeout.
Server environment: Net Core 2.1.15
Reference article: https://www.cnblogs.com/OpenCoder/p/10307882.html , test it, the third method set ~~~ timeout is of no use in the code
Then look at the first two methods, see the local IIS Express timeout setting is 23:00:00, so the server can also set this time.
<?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>