HTTP Error 502.5 - ANCM Out-Of-Process Startup Fai

2020-02-23 05:05发布

After upgrading my project to ASP.NET Core 2.2, I tried to run the application (locally of course) and the browser displayed an error message like in the below screenshot.

enter image description here

no more errors notified by visual studio error explorer. I don't know what's happen.

21条回答
Animai°情兽
2楼-- · 2020-02-23 05:19

If resetting the project and manually copying Program and Startup classes worked for you, then something was clearly messed up. There are some bigger underlying problems with this. Using the OutOfProcess hosting model is okay, but with .Net Core 2.2 you should be able to use the InProcess hosting model, since it is naturally faster: everything is processed in IIS, without an extra HTTP-hop between IIS and your app's Kestrel server.

If you right-click your project file in the visual studio solution explorer, please make sure that AspNetCoreModuleName tag has AspNetCoreModuleV2 value (as opposed to the older AspNetCoreModule). Also, examine Windows Application Event Log to identify the potential culprit. Even though error messages there are somewhat cryptic, they might point you to the exact line number in the code that caused the failure.

Finally, in case you use CI/CD with TFS, there may be environment variable(s) in appsettings.json file that were not properly replaced with the actual values (URLs, etc.).

查看更多
不美不萌又怎样
3楼-- · 2020-02-23 05:19

Same failture happent on project publish. The issue ralated with the latest Microsoft.AspNetCore.App package. Just downcast it from from 2.2.x to 2.2.0 or goto dotnet.microsoft.com/download/dotnet-core/2.2 and get newest dotnet-hosting installer

查看更多
SAY GOODBYE
4楼-- · 2020-02-23 05:20

In my case it was the log level set incorrectly in the appsettings.json. Instead of Warning I've had Warn and this crashed the app with above error.

查看更多
5楼-- · 2020-02-23 05:21

This happened to me when I deployed code using Entity Framework Core with migrations, and there was mismatch between the state of the database and the migrations in the code.

查看更多
Bombasti
6楼-- · 2020-02-23 05:21

This happened to me first time publishing an Azure Web App. Here is how I solved it:

Browse the site using Kudo/FTP. In the root folder there is a LogFiles folder where you find eventlog.xml. In this file I could see that my web app had an SqlException when Entity Framework Core was trying to setup the database, which lead me to check the database permissions (which was the problem for me).

查看更多
迷人小祖宗
7楼-- · 2020-02-23 05:21

If you are working with ASP.Net Core version 2.2 then in appsettings.json just comment the line -

"AllowedHosts": "*"

it resolves the issue. My application working fine.

查看更多
登录 后发表回答