This article is contributed. See the original author and article here.

When you host ASP.Net Core 2.x version in IIS/IIS Express, the application runs in a process separate from the IIS worker process (out-of-process) with the Kestrel server. Here you can find the detailed explanation on publishing an ASP.NET Core app to an IIS server.


 


Recently, I came across an issue where ASP.Net Core 2.x version failed to start with the error below:


 


 


Exceptions:


 


After browsing the page, the exception on the browser:


 


HTTP Error 502.5 – Process Failure


 


Common causes of this issue:


The application process failed to start


The application process started but then stopped


The application process started but failed to listen on the configured port


 


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


 


In the Event Viewer logs, the error will be:


 


Event ID 1020 from Source: AspNetCoreModuleV2


 


Application ‘/LM/W3SVC/1/ROOT/Site’ with physical root ‘<path>’ failed to start process with commandline ‘<path><application>.exe ‘ at stage ‘CreateProcessW’, ErrorCode = ‘0x80070002’, assigned port xxx, retryCounter ‘0’.


 


 


Root Cause:


There are many reasons when process fails to start. One of the reasons is documented here:


ASP.Net core application exe was quarantined by the Anti-virus.


 


 


Resolution:


The application runs in a process separate from the IIS worker process (out-of-process). So two processes will spawn to process the requests: IIS worker process(w3wp.exe) and Application process(dotnet.exe/Application.exe)


Both w3wp.exe and exe of the application(application.exe or dotnet.exe) must be excluded from Anti-virus scanning.


 


This article includes information about folders that need to be excluded from antivirus scanning in ASP.net applications.

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.