IIS and NET Core HTTP Error 500.30 - ANCM In-Process Start Failure .net core 3.1

Viewed 17366

I've created application in .NET Core from template - with Angular and Authentication. .NET Core 3.1 In Properties->Debug-> for IIS profile I've setup Hosting Model as Out of process. But in Web.config I have still inprocess. I've installed ASP Core Runtime from this site: https://dotnet.microsoft.com/download/dotnet/current When I run my project as IIS Express it works. But when I copy published files to the IIS folder I have error:

HTTP Error 500.30 - ANCM In-Process Start Failure
Common solutions to this issue:
The application failed to start
The application started but then stopped
The application started but threw an exception during startup
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265 

I've tried many resolution from the internet because error is well known, but without result.

My dotnet info:

C:\tasks\TestApp\WebApplication2\WebApplication2>dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.300
 Commit:    b2475c1295

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.17763
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.300\

Host (useful for support):
  Version: 3.1.4
  Commit:  0c2e69caa6

.NET Core SDKs installed:
  1.1.0 [C:\Program Files\dotnet\sdk]
  2.0.2 [C:\Program Files\dotnet\sdk]
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.507 [C:\Program Files\dotnet\sdk]
  2.1.508 [C:\Program Files\dotnet\sdk]
  2.2.103 [C:\Program Files\dotnet\sdk]
  3.0.100 [C:\Program Files\dotnet\sdk]
  3.1.300 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

I've changed InProcess to OutOfProcess, now my config looks like:

<system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\WebApplication2.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
  </system.webServer>

And I get error:

An error occurred while starting the application.
3 Answers

enter image description here

You can just edit your web.config inside of your ASP.NET Core application folder. By default it is inside of wwwroot folder.

Change the value of AspNetCoreHostingModel or hostingModel to OutOfProcess.

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
  <location path="." inheritInChildApplications="false"> 
    <system.webServer>
      <handlers> 
        <add name="aspNetCore" path="" verb="" modules="AspNetCoreModule" resourceType="Unspecified" /> 
      </handlers> 
      <aspNetCore processPath=".\fad.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" /> 
    </system.webServer> 
  </location> 
</configuration> 
<!--ProjectGuid: 4904ffb5-a4a6-4e5a-bc46-51d1171d82b0-->

After heading whole 1 day I find a great solution, please the following point :-

  1. go to your project folder via cmd.
  2. type dotnet publish --e/:output (note this will publish the code in e drive output folder)
  3. go to output folder via cmd
  4. type dotnet <project-name.dll> (this will run the application in localhost:5003)
  5. If any issue occur with above step this will show in the cmd, I had faced the issue of, where one folder is missing. Once I added the folder the issue resolved.

Did you notice that your publish profile is displayed as enter image description here

So please go to the root folder of your project and open .csproj with notepad.

Then modify <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>

to

<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>

and re-publishing.

Or you can try to modify publish profile from <MSDeployPublishMethod>InProcess</MSDeployPublishMethod> to <MSDeployPublishMethod>OutofProcess</MSDeployPublishMethod> Then modify

hostingModel="inprocess" to hostingModel="OutOfProcess" from your asp.net core handler in IIS web.config.

Related