Reacting to new Hosting API

This commit is contained in:
John Luo 2015-12-17 21:21:15 -08:00
parent 8b8707b84b
commit cb4c05084b
4 changed files with 33 additions and 19 deletions

View File

@ -1,18 +1,17 @@
{
"webroot": "wwwroot",
"exclude": "wwwroot/**/*",
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.WebSockets.Server": "1.0.0-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:12345",
"kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:12344"
},
"frameworks" : {
"dnx451" : { },
"dnxcore50" : { }
}
"exclude": "wwwroot/**/*",
"dependencies": {
"Microsoft.AspNet.WebSockets.Server": "1.0.0-*",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
},
"compilationOptions": {
"emitEntryPoint": true
},
"commands": {
"web": "AutobahnTestServer"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
}
}

View File

@ -6,6 +6,7 @@ using System.Net.WebSockets;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.WebSockets.Server;
@ -69,5 +70,15 @@ namespace AutobahnTestServer
}
await webSocket.CloseAsync(result.CloseStatus.Value, result.CloseStatusDescription, CancellationToken.None);
}
public static void Main(string[] args)
{
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseStartup<Startup>()
.Build();
application.Run();
}
}
}

View File

@ -0,0 +1,3 @@
{
"server": "Microsoft.AspNet.Server.Kestrel"
}

View File

@ -45,12 +45,13 @@ namespace Microsoft.AspNet.WebSockets.Client.Test
var config = configBuilder.Build();
config["server.urls"] = "http://localhost:54321";
var host = new WebHostBuilder(config)
var application = new WebApplicationBuilder()
.UseConfiguration(config)
.UseServerFactory("Microsoft.AspNet.Server.Kestrel")
.UseStartup(startup)
.Configure(startup)
.Build();
return host.Start();
return application.Start();
}
}
}