Multiple ASP.NET Core / 5+ apps on the same web space

From ASP.NET Core 3.0 or .NET 5 and later, apps are set to use the InProcess hosting model instead of OutOfProcess.

The InProcess model only allows 1 app per app pool, which is why you may experience problems, if you publish multiple apps on the same web space, as each one has 1 app pool assigned.

As a work-around, you can set your apps to use the OutOfProcess model instead.

This can be done through the .csproj file in Visual Studio.

  1. Select "Project" in the menu bar
  2. Click "Edit project file"
  3. This opens the .csproj file. Insert <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel> beneath the "TargetFramework" line.

The hosting model can also be changed in web.config after deployment. In <aspNetCore />, "hostingModel" is defined and can be changed to "OutofProcess".
However, with this solution, you must remember to change it after new deployments of the app.

Article from the support category: ASP & ASP.NET

Other relevant articles