简体   繁体   中英

ASP.NET CORE settimeout in json file

i'm getting 502.3 error from my asp.net core application [long requests] and from answers: Timeouts with long running ASP.NET MVC Core Controller HTTPPost Method and Request timeout from ASP.NET Core app on IIS i see that i need to extend timeouts but every answer contains setting timeouts in webconfig xml file and i'm using json file for my configuration.

    {
  "AppConfig": {
    "Name": "...",
    "ConnectionString": "Server=localhost;User Id=root;Password=....;Database=....",
  }

I also have a launchSettings.json

    {
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:53573/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "SPS.Services": {
      "commandName": "Project"
    }
  }
}

How should equivalent look like from xml:

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

and where should i put it?

I'm using AspNetCore 1.1.2

If you run your app "behind" IIS (you do, according to launchSettings), then you must make sure all items in chain (IIS, IIS/AspNetCore module that calls Kestrel and Kestrel itself) are not kill long-running requests.

Kestrel does not have any request timeouts , nothing to configure.

For configuring IIS-related stuff, you should still use web.config , because IIS knows nothing about your json files. So feel free to create and modify web.config file using links you provided.

I had the same problem, and the only way to solve it was creating a web.config file for my application. So I now have the appsettings.json plus the web.config.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM