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.
no more errors notified by visual studio error explorer. I don't know what's happen.
For me the issue was caused by
dotnet publish
creating a web.config entrystdoutLogFile=".\logs\stdout"
. The correct value should bestdoutLogFile="\\?\%home%\LogFiles\stdout"
.MSDN reference: https://blogs.msdn.microsoft.com/waws/2018/06/10/troubleshooting-http-502-5-startup-issues-in-azure-appservice-for-asp-net-core-websites/
This could be a bug in the ASP.NET Core 2.2.0 runtime which may have been fixed in a later version.
This error started appearing on our Dev server. I had been using this publish command which creates a "self-contained" folder of files for deployment.
My fix was to instead publish a "framework-dependent" deployment using the following command:
The dev server did have a few versions of .NET Core installed (2.2.3 and 2.2.5) in this folder *
C:\Program Files\dotnet\shared
I am still not clear on why the self contained publish does not work. You might think the self contained publish would be the more reliable method, but in my case it was not.
This .NET Core blog post was helpful.
My issues was malformed appsetttings.json file. I enabled standard out logging via web.config and was able to get the underlying exception throwing this error.
I got this same error while deploying .Net core app which was targeting .Net framework on Windows server. I checked event viewer on the server and turns out server didn't have .net 4.7.2 installed.
Installing it resolved issue for me.
I encountered this error after trying to publish from VS2017 to the production Windows 2016 server. (It worked fine in IIS Express on my local Win10 PC.)
I updated packages, all versions matching and updated in my code, .net core versions matching, restart IIS, rebooting... no joy.
In the Publish > Configure > Settings (left tab) I had to set the Target-runtime from "Portable" to "win-x64" (or whatever is relevant to your environment). I also opted to "Remove additional files at destination."
"Portable" is the default setting. I'm not sure what it takes for the "Portable" runtime to work properly, but might save someone else some time if a "Portable" runtime is not something you need.
Generally speaking, I get this error if something is mismatched in my environment. For example, one time I was upgrading one of my projects to .Net Core 3.1 from 2.2 and hadn't installed the ASP.NET Core Runtime Hosting Bundle on my server:
https://dotnet.microsoft.com/download/dotnet-core/3.1
Also, you can get this error if your Application Pool is set to True for Enable 32-Bit Applications. Try:
I ran into this issue today with my hosting - locally everything is ok but once I publish, I get this error.
I looked through the packages and found out that some .net core stuff was upgraded to 3.0 preview.
Then I changed the build option in VS2019 from "Framework-Dependent" to "Self-contained". It took 5 times longer to build and publish but now it works.
Now I'm checking with host tech support what might be an issue - officially they support 2.1 / 2.2 only, so this might be these packages from 3.0 Preview, however target build is 2.2.