I'm hosting an ASPNET Core 1.1 app on IIS with the following settings to keep it always running
However, I see the app getting terminated time to time. Before termination I see the following in the logs
2018-03-14 17:20:53.202 [Information] Request starting HTTP/1.1 POST http://127.0.0.1:32751/myapp/iisintegration 0
2018-03-14 17:20:53.205 [Information] Request finished in 3.98ms 202
2018-03-14 17:20:53.203 [Error] Unhandled exception
System.Threading.Tasks.TaskCanceledException: A task was canceled.
The POST /iisintegration
looks interesting. Is IIS sending a command to terminate the app?
P.S.
After digging around IIS integration middleware, it looks like that POST
is actually IIS sending a termination command. This is the code that handles it
private static readonly PathString ANCMRequestPath = new PathString("/iisintegration");
...
// Handle shutdown from ANCM
if (HttpMethods.IsPost(httpContext.Request.Method) &&
httpContext.Request.Path.Equals(ANCMRequestPath) &&
string.Equals(ANCMShutdownEventHeaderValue, httpContext.Request.Headers[MSAspNetCoreEvent], StringComparison.OrdinalIgnoreCase))
{
// Execute shutdown task on background thread without waiting for completion
var shutdownTask = Task.Run(() => _applicationLifetime.StopApplication());
httpContext.Response.StatusCode = StatusCodes.Status202Accepted;
return;
}
So my question is: Is there a way to disable this functionality?
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.
An ASP.NET Core app can be hosted on Windows as a Windows Service without using IIS. When hosted as a Windows Service, the app automatically starts after server reboots.
ASP.NET Core no longer uses the Global. asax and web. config files that previous versions of ASP.NET utilized.
Try to remove your Recycling Conditions
from your application pool
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