ASP.NET Core Out-Of-Process Startup Failure in Docker Container with Virtual Application

Problem Description I’m migrating the application from a container-to-container communication architecture to a single container with a virtual application approach to test. In my visual studio First I have upgraded from .NET 4.6.1 to .NET 4.8 Previous Architecture (Working): Two separate Docker containers (Working) Container 1: Main application running on .NET Framework 4.8 Container 2: web.security (IdentityServer3 implementation) configured with AspNetCoreModuleV2 with .NET 4.8 Direct container-to-container network communication Identity Server was accessible and working correctly

This are the commands used

docker run -d -p 14167:80 --name web-security xx-web-security:1.0`
docker inspect -f "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}" web-security
docker run -d -p 10097:80 --name yy-solution --add-host=web-security:[IP_ADDRESS] -- yy-app:solution

Current Architecture (Not Working): Single Docker container based on mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019 Main application in /inetpub/wwwroot/ Web.Security as a virtual application under /WebSecurity path Using New-WebApplication to create the virtual application Exposing port 80 and mapping to host port 10097

The Issue: When I try to access http://localhost:10097/WebSecurity/, I get an “HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure” error Instead of IdentityServer3 implementation page

Key Questions:

  1. Why did the SS.Web.Security application work with AspNetCoreModuleV2 in a separate container but fails as a virtual application?
  2. Is there a specific configuration needed when hosting an IdentityServer3 application with ASP.NET Core module as a virtual application?
  3. What’s the proper approach for hosting a .NET application using AspNetCoreModuleV2 as a virtual application under IIS in a Docker container?

I’m afraid this ould require a .NET developer to know how it handles requests in different situations, but you can find this error message on Microsofts foruma s well. Maybe it can give you some ideas.