Use GetServiceOrDefault for optional dependency

This commit is contained in:
Stephen Halter 2014-06-11 18:32:40 -07:00
parent 25bbfa7165
commit abbd763f0f
1 changed files with 1 additions and 1 deletions

View File

@ -78,7 +78,7 @@ namespace Microsoft.AspNet.Hosting
{ {
if (context.ServerFactory == null) if (context.ServerFactory == null)
{ {
context.ServerFactory = context.Services.GetService<IServerFactory>(); context.ServerFactory = context.Services.GetServiceOrDefault<IServerFactory>();
} }
if (context.ServerFactory != null) if (context.ServerFactory != null)
{ {