#1001 don't log stack traces for localhost bind failures.
This commit is contained in:
parent
02b84d7ae1
commit
53e5c3d56c
|
|
@ -150,14 +150,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel
|
||||||
}
|
}
|
||||||
catch (AggregateException ex) when (ex.InnerException is UvException)
|
catch (AggregateException ex) when (ex.InnerException is UvException)
|
||||||
{
|
{
|
||||||
if ((ex.InnerException as UvException).StatusCode == Constants.EADDRINUSE)
|
var uvEx = (UvException)ex.InnerException;
|
||||||
|
if (uvEx.StatusCode == Constants.EADDRINUSE)
|
||||||
{
|
{
|
||||||
throw new IOException($"Failed to bind to address {parsedAddress.ToString()} on the IPv4 loopback interface: port already in use.", ex);
|
throw new IOException($"Failed to bind to address {parsedAddress.ToString()} on the IPv4 loopback interface: port already in use.", ex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogWarning(0, ex, $"Unable to bind to {parsedAddress.ToString()} on the IPv4 loopback interface.");
|
_logger.LogWarning(0, $"Unable to bind to {parsedAddress.ToString()} on the IPv4 loopback interface: ({uvEx.Message})");
|
||||||
exceptions.Add(ex.InnerException);
|
exceptions.Add(uvEx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,14 +170,15 @@ namespace Microsoft.AspNetCore.Server.Kestrel
|
||||||
}
|
}
|
||||||
catch (AggregateException ex) when (ex.InnerException is UvException)
|
catch (AggregateException ex) when (ex.InnerException is UvException)
|
||||||
{
|
{
|
||||||
if ((ex.InnerException as UvException).StatusCode == Constants.EADDRINUSE)
|
var uvEx = (UvException)ex.InnerException;
|
||||||
|
if (uvEx.StatusCode == Constants.EADDRINUSE)
|
||||||
{
|
{
|
||||||
throw new IOException($"Failed to bind to address {parsedAddress.ToString()} on the IPv6 loopback interface: port already in use.", ex);
|
throw new IOException($"Failed to bind to address {parsedAddress.ToString()} on the IPv6 loopback interface: port already in use.", ex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_logger.LogWarning(0, ex, $"Unable to bind to {parsedAddress.ToString()} on the IPv6 loopback interface.");
|
_logger.LogWarning(0, $"Unable to bind to {parsedAddress.ToString()} on the IPv6 loopback interface: ({uvEx.Message})");
|
||||||
exceptions.Add(ex.InnerException);
|
exceptions.Add(uvEx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue