Async Main samples (#2004)
This commit is contained in:
parent
7f23ff08ce
commit
59b77bb357
|
|
@ -15,7 +15,6 @@ namespace LargeResponseApp
|
||||||
private const int _chunkSize = 4096;
|
private const int _chunkSize = 4096;
|
||||||
private const int _defaultNumChunks = 16;
|
private const int _defaultNumChunks = 16;
|
||||||
private static byte[] _chunk = Encoding.UTF8.GetBytes(new string('a', _chunkSize));
|
private static byte[] _chunk = Encoding.UTF8.GetBytes(new string('a', _chunkSize));
|
||||||
private static Task _emptyTask = Task.FromResult<object>(null);
|
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app)
|
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()
|
var host = new WebHostBuilder()
|
||||||
.UseKestrel(options =>
|
.UseKestrel(options =>
|
||||||
|
|
@ -49,7 +48,7 @@ namespace LargeResponseApp
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
host.Run();
|
return host.RunAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ namespace SampleApp
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Main(string[] args)
|
public static Task Main(string[] args)
|
||||||
{
|
{
|
||||||
TaskScheduler.UnobservedTaskException += (sender, e) =>
|
TaskScheduler.UnobservedTaskException += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
|
@ -89,7 +89,7 @@ namespace SampleApp
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
host.Run();
|
return host.RunAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue