简体   繁体   English

在 asp .net core 3 中设置请求超时

[英]Set the request timeout with In-process hosting in asp .net core 3

I have an asp .net core website with the following in the web.config我有一个 asp .net 核心网站,在 web.config 中有以下内容

<aspNetCore processPath="%LAUNCHER_PATH%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" arguments="%LAUNCHER_ARGS%" requestTimeout="00:20:00">

However it times out with the error但是它超时并出现错误

HTTP Error 500.37 - ANCM Failed to Start Within Startup Time Limit

I can see from https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.0 there the requestTimeout attribute doesn't apply to in-process hosting.我可以从https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.0看到 requestTimeout 属性不适用于 in-进程托管。 Is there an alternative way to increase the timeout?有没有增加超时的替代方法?

Another way forward would be rejig the application so it doesn't take so long to load on first hit, but for now I am trying to avoid that.另一种前进的方法是重新调整应用程序,以便在第一次点击时加载不需要很长时间,但现在我试图避免这种情况。

I have faced the same issue and after spent a time looking for the root cause and possible solutions, I understood that this happens when there are many app pools on the same machine, which is my case.我遇到了同样的问题,在花了一些时间寻找根本原因和可能的解决方案之后,我了解到当同一台机器上有许多应用程序池时会发生这种情况,这就是我的情况。

Microsoft recommends to stagger the startup process of multiple apps.微软建议错开多个应用的启动过程 Another solution would be increase the start up limit .另一种解决方案是增加启动限制

I've seen some people talking about changing the hostProcess from Inbound to Outbound , this may works, but the IS HTTP Server won't be used, but Kestrel web server is used to process the requests.我见过有人谈论将 hostProcess 从Inbound更改为Outbound ,这可能有效,但不会使用 IS HTTP 服务器,但使用Kestrel web 服务器来处理请求。

I think the best solution is to stagger the startup process either increase the start up limit.我认为最好的解决方案是错开启动过程或者增加启动限制。

Here you can find more info: https://docs.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-3.0在这里您可以找到更多信息: https://docs.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-3.0

https://tutorialshelper.com/what-is-the-difference-between-inprocess-and-outofprocess-service-in-asp-net-core/ https://tutorialshelper.com/what-is-the-difference-between-inprocess-and-outofprocess-service-in-asp-net-core/

I have seen the same error occur in IIS hosted .NET Core 3.1 Web API applications.我已经看到在 IIS 托管的 .NET Core 3.1 Web ZDB974238714CA38DE634A7CE1D08 应用程序中发生了同样的错误。

One suggestion that always works for me is to recycle the IIS App Pool for the application.对我来说始终有效的一项建议是为应用程序回收 IIS 应用程序池。

If you are hosting applications in a production environment in IIS, I would recommend scheduling recycling of the App Pools regularly as this frees up memory used by the w3wp.exe worker processes.如果您在 IIS 的生产环境中托管应用程序,我建议您定期安排应用程序池的回收,因为这可以释放 w3wp.exe 工作进程使用的 memory。

If the above workaround does not resolve the issue, another suggestion is to debug the application during the startup ConfigureServices() and Configure() methods and see what else could be delaying startup.如果上述解决方法不能解决问题,另一个建议是在启动 ConfigureServices() 和 Configure() 方法期间调试应用程序,看看还有什么可能会延迟启动。

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

相关问题 HTTP 错误 500.0 - ASP.NET 核心 IIS Dot.net 核心 3.1 中的托管失败(进程中) - HTTP Error 500.0 - ASP.NET Core IIS hosting failure (in-process) in Dot net core 3.1 ASP .NET Core 3 + 进程内和进程外托管的身份服务器问题 - ASP .NET Core 3 + Identity Server issue with in-process and out-of-process hosting ASP.NET Core在构建过程中设置托管环境 - ASP.NET Core set hosting environment in build process .NET 核心托管到 IIS,我收到 HTTP 错误 500.30 - ANCM 进程内启动失败 - .NET Core hosting to IIS, I get HTTP Error 500.30 - ANCM In-Process Start Failure HTTP 错误 500.35 - ANCM 同一进程中的多个进程内应用程序 ASP.NET 核心 3 - HTTP Error 500.35 - ANCM Multiple In-Process Applications in same Process ASP.NET Core 3 具有进程内托管的Dotnet核心多个启动类 - Dotnet Core Multiple Startup Classes with In-Process Hosting HTTP 错误 500.30 - ANCM 进程中启动失败 Asp.net-Core 3.1 - HTTP Error 500.30 - ANCM In-Process Start Failure Asp.net-Core 3.1 ASP.NET Core 3 Web应用程序,Azure App Service和ANCM进程内处理程序加载失败 - ASP.NET Core 3 Web Application, Azure App Service, and a ANCM In-Process Handler Load Failure 无法调试进程内Web项目(ASP.NET核心模块) - Unable to debug in-process web project (ASP.NET Core Module) ASP.NET 核心 3.1 - HTTP 错误 500.30 - ANCM 进程中启动失败 - ASP.NET Core 3.1 - HTTP Error 500.30 - ANCM In-Process Start Failure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM