I am hosting an ASP.NET Core (2.2) app in IIS.
The app is using a custom app pool with below settings:
.NET CLR version: No Managed Code
Start Mode: Always Running
Idle Time-out (minutes): 0
My startup code looks like:
WebHost.CreateDefaultBuilder(args)
.UseStartup<MyStartup>()
.Build()
.Run();
I am expecting that the app will always run, but after some time the app stops after getting below request:
[Microsoft.AspNetCore.Hosting.Internal.WebHost] Request starting HTTP/1.1 POST http://127.0.0.1:43745/app/iisintegration 0 [Microsoft.AspNetCore.Hosting.Internal.WebHost] Request finished in 5.7107ms 202
The app is a sub app. The parent app is using different app pool, and does have idle time-out.
Is there some setting I am missing to keep the app up all the time ?
The module allows ASP.NET Core apps to run behind IIS. If the Hosting Bundle is installed before IIS, the bundle installation must be repaired. Run the Hosting Bundle installer again after installing IIS.
Found a solution which is working. You need to host your ASP.NET Core 2.2 app using in-process hosting model. Below steps can be followed for it.
Server Manager > Add roles and Features > Server Roles > Web Server (IIS) > Application Development > Application Initialization
IIS > Your App Pool > Start Mode > Always Running
IIS > Your App Pool > Idle Time-out > 0
IIS > Your App > Advanced Settings > Preload Enabled > True
Setup your app for In-Process hosting model (web.config changes for Asp.net core module and code changes to set correct current directory)
More information can be found at:
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-2.2
https://github.com/aspnet/AspNetCore.Docs/issues/12232
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-2.2
https://github.com/aspnet/AspNetCore/issues/6075
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With