简体   繁体   中英

IIS killing ASPNET Core app

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?

PS

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?

尝试从应用程序池中删除Recycling Conditions

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM