Why won't .NET 5.0 website won't run from IIS?

38 Views Asked by At

I've a .NET 5.0 website that runs in the QA environment without error. I copy the same files to production, and when I try to hit the website in a browser I get:

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

If I run the website from command line it runs and I can open it in a browser without error.

I have the .NET 5.0 hosting bundle installed (recently reinstalled). The host in question also has ASP.NET Core 3.1.32 installed also.

The Windows event viewer shows:

Application '/LM/W3SVC/2/ROOT' with physical root 'D:\www' failed to start process with commandline '"dotnet" .\Web.dll' with multiple retries. Failed to bind to port '2230'. First 30KB characters of captured stdout and stderr logs from multiple retries:

I don't know why it's trying to use port 2230, IIS is configured to use port 80. On some attempts it tries to bind to other ports (9000-odd).

I'm using the same web.config as from my QA, with one exception. In QA I have:

In production I have to use:

I don't understand how in QA the module "AspNetCoreModule" is running our .NET 5 site, but I thought that required "AspNetCoreModuleV2"?

I've spent a few hours Googling this, no luck so far.

1

There are 1 best solutions below

0
Developer Webs On

I don't know why, but in web.config I had to add the hostingModel attribute to aspNetCore

<aspNetCore processPath="dotnet" arguments=".\Pim.Web.dll"  hostingModel="inprocess" />

... but I thought "inprocess" was the default anyway?

Further, I had to install the .NET 2.1.15 hosting bundle because it would not work without it. And not just the runtimes, but it needs the hosting environment itself.

At the same time, it won't run without the .NET 5 hosting bundle.