简体   繁体   English

IIS杀死ASPNET核心应用程序

[英]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 我正在IIS上使用以下设置托管ASPNET Core 1.1应用程序,以使其始终运行

在此输入图像描述

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. POST /iisintegration看起来很有趣。 Is IIS sending a command to terminate the app? IIS是否发送命令终止应用程序?

PS PS

After digging around IIS integration middleware , it looks like that POST is actually IIS sending a termination command. 在挖掘IIS集成中间件之后 ,看起来POST实际上是IIS发送终止命令。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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