Use SocketTransportFactory rather than libuv.

Libuv is no longder the default in .NET Core 2.1.
This commit is contained in:
Pete Chown
2018-11-07 10:58:22 +00:00
parent 9673ea13c5
commit 718ae98755

View File

@@ -9,8 +9,7 @@ using Microsoft.AspNetCore.Hosting.Server;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal;
using Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets;
using Microsoft.AspNetCore.WebSockets;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
@@ -77,14 +76,14 @@ namespace Kestrel
var serverOptions = new KestrelServerOptions();
serverOptions.ListenAnyIP(8080);
var uvOptions = new LibuvTransportOptions();
var transportOptions = new SocketTransportOptions();
var loggerFactory = new NullLoggerFactory();
var lifetimeLogger = new NullLogger<ApplicationLifetime>();
var applicationLifetime = new ApplicationLifetime(lifetimeLogger);
var transportFactory = new LibuvTransportFactory(
new OptionsWrapper<LibuvTransportOptions>(uvOptions), applicationLifetime, loggerFactory);
var transportFactory = new SocketTransportFactory(
new OptionsWrapper<SocketTransportOptions>(transportOptions), applicationLifetime, loggerFactory);
using (var server = new KestrelServer(new OptionsWrapper<KestrelServerOptions>(serverOptions),
transportFactory, loggerFactory))