What should we do when get "HTTP Error 500.34 - ANCM Mixed Hosting Models Not Supported"?

Programming, error messages and sample code > ASP.NET

We found some customer got below error when run asp.net core application on our web server. This article will help us to get clear on such issue and solve it. If you host asp.net core application in separated pool, then you would not get such issue. Our .net premium and higher plans do support multiple app pool.

HTTP Error 500.34 - ANCM Mixed Hosting Models Not Supported
Common solutions to this issue:
Select a different application pool to create another application.
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

To solve this issue, you can refer to one of the below solutions:

1) If you are with our .net basic or .net advance plan, we would suggest you to use ASP.NET core OutOfProcess mode, you can change hosting model from our Control Panel.
2) Upgrade to premium or higher plan to host .net core app separately in dedicated pool.
Once you are with .net premium or higher plan, you can create multiple dedicated pool and move site to dedicated pool. For more detail, you can refer to Here.

Why you get this error?

500.34 ANCM Mixed Hosting Models Not Supported

The worker process can't run both an in-process app and an out-of-process app in the same process.

To fix this error, Microsoft recommend to run apps in separate IIS application pools.

500.35 ANCM Multiple In-Process Applications in same Process

The worker process can't run multiple in-process apps in the same process.

To fix this error, Microsoft recommend to run apps in separate IIS application pools.

We assign one dedicated pool for one hosting account. So all your websites running in same App pool. Once there are 2 or more ASP.NET core app run with inprocess mode, you will get above error.

Know more about hosting models 

Whenever you create an ASP.NET Core application it by defaults contains an internal server provided by a .NET Core which is called as Kestrel. Due to this server, we can run ASP.NET Core apps on any platform like Windows, Mac or Linux. Before getting in details about hosting models lets first see what is Kestrel server.


What is the Kestrel Server?

According to the ASP.NET core docs:

Kestrel is a cross-platform web server for ASP.NET Core. Kestrel is the webserver that's included by default in ASP.NET Core project templates.

Kestrel is based on the libuv library, the same library which is used by Node.
Some features of Kestrel,

  • It supports SSL
  • Supports Http/2
  • lightweight
  • cross-platform
Hosting Models in ASP.NET Core

There are 2 types of hosting models in ASP.NET Core i.e In-process Hosting and Out-of-process Hosting. Before .NetCore 2.2 we have only one hosting model which is Out-of-process but after due to the performance we have In Process Hosting Model in 2.2+ versions.

Out-of-process Hosting Model

In Out-of-process hosting models, we can either use Kestrel server directly as user request facing server or we can deploy the app into IIS which will act as a proxy server and sends requests to internal Kestrel server. In this type of hosting model we have two options:

Using Kestrel

So in this type Kestrel itself acts as edge server which directly server user requests. It means that we can only use the Kestrel server for our application.

Using Proxy Server

Due to limitations of Kestrel server, we can not use this in all the apps so in such cases we have to use powerful servers like IIS, NGINX or Apache. So, in that case, this server acts as a reserve proxy server which redirects every request to the internal Kestrel sever where our app is running. Here, two servers are running like one is IIS and another is Kestrel.

This model is a default model for all the applications implemented before .NET Core 2.2. But there are some of the limitations of using this type such as performance slowness.

In-process Hosting Model

After the release of .NET Core 2.2, it introduced a new type of hosting which is called as In-process hosting. In this type, only one server is used for hosting like IIS, Nginx or Linux. It means that the App is directly hosted inside of IIS. No Kestrel server is being used. IIS HTTP Server (IISHttpServer) is used instead of Kestrel server to host app in IIS directly. ASP.NET Core 3.1 onwards In-process hosting model is used as a default model whenever you create a new application using an existing template.

Run the application on *IISExpress * server then open the browsers network tab and check for the first call. Under the server section, you will able to see its showing Microsoft IIS.

Now open the command prompt and run the same application using dotnet CLI bu using command dotnet run. Now it will host app on http://localhost:5000

Browse the URL and open network tab and see the server attribute as Kestrel.

How to change hosting model manually ?

You may have one question in your mind like where are these type defines?
There are two ways to define the models:

  • .csproj file----From your Visual Studio before Publish
  • web.config file---From your website root folder after Publish

In .csproj file

Open the .csproj file and add the below property to apply the proper hosting model.

So the value <AspNetCoreHostingModel> property is case insensitive and if we don't define this property then it by deafults consider as In-process hosting model.

In web.config

In ASP.NET Core apps we don't have web.config so first, we have to publish the app and in the published folder you can see the web.config the file generated by ASP.NET Core. Now published the app you have created earlier and open the config file. It looks like this:

<?xml version="1.0" encoding="utf-8"?>
  <location path="." inheritInChildApplications="false">
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      <aspNetCore processPath="dotnet" arguments=".\DotNetCoreApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
As I mentioned earlier, from ASP.NET Core 3.1, the In-process hosting model is the default model. So if you want to change it to other i.e. Out -of-process then you just need to change hostingModel="OutOfProcess".
To troubleshoot more issue about host asp.net core applications, you can refer to Microsoft guide here: