简体   繁体   English

json文件中的ASP.NET CORE settimeout

[英]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. 我从asp.net核心应用程序[长请求]和答案中收到502.3错误: 长时间运行ASP.NET MVC核心控制器HTTPPost方法的 超时IIS上ASP.NET Core应用程序的请求超时我看到我需要延长超时时间,但每个答案都包含webconfig xml文件中的设置超时时间,我正在使用json文件进行配置。

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

I also have a launchSettings.json 我也有一个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: 从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 我正在使用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. 如果在IIS后面“运行”应用程序(根据launchSettings的说明进行),则必须确保链中的所有项(IIS,调用Kestrel的IIS / AspNetCore模块和Kestrel本身)都不会杀死长期运行的请求。

Kestrel does not have any request timeouts , nothing to configure. Kestrel没有任何请求超时 ,无需配置。

For configuring IIS-related stuff, you should still use web.config , because IIS knows nothing about your json files. 对于配置与IIS相关的内容,您仍应使用web.config ,因为IIS对您的json文件一无所知。 So feel free to create and modify web.config file using links you provided. 因此,请使用您提供的链接随意创建和修改web.config文件。

I had the same problem, and the only way to solve it was creating a web.config file for my application. 我遇到了同样的问题,解决此问题的唯一方法是为我的应用程序创建一个web.config文件。 So I now have the appsettings.json plus the web.config. 现在,我有了appsettings.json和web.config。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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