Permalink
Browse files

Since the IWebHost implements IDisposable, let's make the templates e…

…nforce best practices.
  • Loading branch information...
1 parent b4d3a40 commit 37e78bd0dc33069901cc51924fe8a2740d1e141c jci-cpined committed Jun 28, 2016
@@ -11,14 +11,15 @@ public class Program
{
public static void Main(string[] args)
{
- var host = new WebHostBuilder()
- .UseKestrel()
- .UseContentRoot(Directory.GetCurrentDirectory())$if$ ($aspnet_useplatformhandler$ == false)$else$
- .UseIISIntegration()$endif$
- .UseStartup<Startup>()
- .Build();
-
- host.Run();
+ using (var host = new WebHostBuilder()
+ .UseKestrel()
+ .UseContentRoot(Directory.GetCurrentDirectory())$if$ ($aspnet_useplatformhandler$ == false)$else$
+ .UseIISIntegration()$endif$
+ .UseStartup<Startup>()
+ .Build())
+ {
+ host.Run();
+ }
}
}
}
@@ -11,14 +11,15 @@ public class Program
{
public static void Main(string[] args)
{
- var host = new WebHostBuilder()
- .UseKestrel()
- .UseContentRoot(Directory.GetCurrentDirectory())$if$ ($aspnet_useplatformhandler$ == false)$else$
- .UseIISIntegration()$endif$
- .UseStartup<Startup>()
- .Build();
-
- host.Run();
+ using (var host = new WebHostBuilder()
+ .UseKestrel()
+ .UseContentRoot(Directory.GetCurrentDirectory())$if$ ($aspnet_useplatformhandler$ == false)$else$
+ .UseIISIntegration()$endif$
+ .UseStartup<Startup>()
+ .Build())
+ {
+ host.Run();
+ }
}
}
}
@@ -12,14 +12,15 @@ public class Program
{
public static void Main(string[] args)
{
- var host = new WebHostBuilder()
- .UseKestrel()
- .UseContentRoot(Directory.GetCurrentDirectory())$if$ ($aspnet_useplatformhandler$ == false)$else$
- .UseIISIntegration()$endif$
- .UseStartup<Startup>()
- .Build();
-
- host.Run();
+ using (var host = new WebHostBuilder()
+ .UseKestrel()
+ .UseContentRoot(Directory.GetCurrentDirectory())$if$ ($aspnet_useplatformhandler$ == false)$else$
+ .UseIISIntegration()$endif$
+ .UseStartup<Startup>()
+ .Build())
+ {
+ host.Run();
+ }
}
}
}

0 comments on commit 37e78bd

Please sign in to comment.