From 59b77bb357f50946ecea310feb8db53473e0e165 Mon Sep 17 00:00:00 2001 From: Ben Adams Date: Fri, 18 Aug 2017 22:46:19 +0100 Subject: [PATCH] Async Main samples (#2004) --- samples/LargeResponseApp/Startup.cs | 5 ++--- samples/SampleApp/Startup.cs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/samples/LargeResponseApp/Startup.cs b/samples/LargeResponseApp/Startup.cs index 47ecd8a08b..c2b7d30a1b 100644 --- a/samples/LargeResponseApp/Startup.cs +++ b/samples/LargeResponseApp/Startup.cs @@ -15,7 +15,6 @@ namespace LargeResponseApp private const int _chunkSize = 4096; private const int _defaultNumChunks = 16; private static byte[] _chunk = Encoding.UTF8.GetBytes(new string('a', _chunkSize)); - private static Task _emptyTask = Task.FromResult(null); public void Configure(IApplicationBuilder app) { @@ -38,7 +37,7 @@ namespace LargeResponseApp }); } - public static void Main(string[] args) + public static Task Main(string[] args) { var host = new WebHostBuilder() .UseKestrel(options => @@ -49,7 +48,7 @@ namespace LargeResponseApp .UseStartup() .Build(); - host.Run(); + return host.RunAsync(); } } } diff --git a/samples/SampleApp/Startup.cs b/samples/SampleApp/Startup.cs index 18b4baacf4..e89e97790b 100644 --- a/samples/SampleApp/Startup.cs +++ b/samples/SampleApp/Startup.cs @@ -35,7 +35,7 @@ namespace SampleApp }); } - public static void Main(string[] args) + public static Task Main(string[] args) { TaskScheduler.UnobservedTaskException += (sender, e) => { @@ -89,7 +89,7 @@ namespace SampleApp .UseStartup() .Build(); - host.Run(); + return host.RunAsync(); } } } \ No newline at end of file