Merge in 'release/2.2' changes

This commit is contained in:
dotnet-bot 2019-07-30 19:56:32 +00:00
commit c950fdbd62
1 changed files with 11 additions and 8 deletions

View File

@ -135,18 +135,21 @@ namespace Microsoft.AspNetCore.Hosting
{
void Shutdown()
{
if (!cts.IsCancellationRequested)
try
{
if (!string.IsNullOrEmpty(shutdownMessage))
{
Console.WriteLine(shutdownMessage);
}
try
if (!cts.IsCancellationRequested)
{
if (!string.IsNullOrEmpty(shutdownMessage))
{
Console.WriteLine(shutdownMessage);
}
cts.Cancel();
}
catch (ObjectDisposedException) { }
}
// When hosting with IIS in-process, we detach the Console handle on main thread exit.
// Console.WriteLine may throw here as we are logging to console on ProcessExit.
// We catch and ignore all exceptions here. Do not log to Console in thie exception handler.
catch (Exception) { }
// Wait on the given reset event
resetEvent.Wait();
@ -184,4 +187,4 @@ namespace Microsoft.AspNetCore.Hosting
await host.StopAsync();
}
}
}
}