diff --git a/src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs b/src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs index 9f7ad6789b..d1025b13b8 100644 --- a/src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs +++ b/src/Microsoft.AspNet.Server.Kestrel/ServerFactory.cs @@ -55,7 +55,14 @@ namespace Microsoft.AspNet.Server.Kestrel disposables.Push(engine); - engine.Start(information.ThreadCount <= 0 ? 1 : information.ThreadCount); + if (information.ThreadCount < 0) + { + throw new ArgumentOutOfRangeException(nameof(information.ThreadCount), + information.ThreadCount, + "ThreadCount cannot be negative"); + } + + engine.Start(information.ThreadCount == 0 ? 1 : information.ThreadCount); foreach (var address in information.Addresses) {