Hosting multiple .net core using the same application pool with AspNetCoreModuleV2
Asked Answered
A

4

9

Hi I am trying to host a multiple .net core 3 application using the same application pool in IIS But were receiving ACME 500 error on the other application and only first one hosted is working Does anyone know whats the reason behind this?

Note: We tried reducing the module version in webconfig "AspNetCoreModuleV2" to "AspNetCoreModule" and the others application worked but I dont want to use this solution.

Alyse answered 31/10, 2019 at 1:11 Comment(3)
Why do they need to be in the same app pool?Hercegovina
The aim for application pool is isolate application from the other. Since sharing app pool is not supported by asp.net core, you may need to select other workaround for this.Pet
"sharing app pool is not supported by asp.net core" is a false statement, as out-of-process mode can work.Mochun
M
20

One app per pool is the design limitation of ASP.NET Core module in-process hosting mode.

Sharing an app pool among apps isn't supported. Use one app pool per app.

You either accept it, or switch to out-of-process mode (actually you did that by using the version 1 of ASP.NET Core module).

Mochun answered 31/10, 2019 at 1:52 Comment(1)
This is correct. I was able to resolve this issue by using out-of-process mode.Premarital
K
5

Two other alternatives are:

Option 1.

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

<PropertyGroup>
   ...
   <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>

In ASP.NET Core apps we don't have web.config so first, we have to publish your application and in the published folder you can see there your web.config the file generated by .NET 5 Core. Now open the config file.like as given below.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\DotNetCoreApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
    </system.webServer>
  </location>
</configuration>

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".

Option 2.

In VS2019

  • Close your solution
  • Delete applicationhost.config in folder .vs or delete the whole .vs folder. The .vs is a hidden folder and is next to your solution file usually.
  • Restart your solution again
Killjoy answered 7/7, 2022 at 0:52 Comment(0)
C
0

I tried running multiple sites sharing same application pool and it worked fine, but then sometimes it behaves strangely so better to have separate application pool.

For example you may encounter following error:

Asp.Net Core 2.2 - HTTP Error 500.0 - ANCM In-Process Handler Load Failure

To avoid such issues create separate application pool for each .NET Core site.

https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.2#in-process-hosting-model

Sharing an app pool among apps isn't supported. Use one app pool per app.

Corinnecorinth answered 8/5, 2020 at 10:17 Comment(0)
K
-1

I faced this issue recently, wanted to add my solution here so it can be helpful to others.

My site was hosted on Plesk based windows hosting and after publishing, I faced this issue

HTTP Error 500.35 - ASP.NET Core does not support multiple apps in the same app pool

Common solutions to this issue: Select a different app pool to host this app.

I solved it by enabling Dedicated IIS App pool for the site in Plesk dashboard. It is not enabled by default.

Kofu answered 29/7, 2022 at 17:53 Comment(1)
Isn't that the same as what the 1st responder said?Killjoy

© 2022 - 2024 — McMap. All rights reserved.