diff --git a/samples/IISSample/Startup.cs b/samples/IISSample/Startup.cs index 46124582f2..e22705f651 100644 --- a/samples/IISSample/Startup.cs +++ b/samples/IISSample/Startup.cs @@ -1,5 +1,6 @@ using System; using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http; using Microsoft.Extensions.Logging; @@ -28,5 +29,15 @@ namespace IISSample } }); } + + public static void Main(string[] args) + { + var application = new WebApplicationBuilder() + .UseConfiguration(WebApplicationConfiguration.GetDefault(args)) + .UseStartup() + .Build(); + + application.Run(); + } } } diff --git a/samples/IISSample/hosting.json b/samples/IISSample/hosting.json new file mode 100644 index 0000000000..f8ef14574d --- /dev/null +++ b/samples/IISSample/hosting.json @@ -0,0 +1,3 @@ +{ + "server": "Microsoft.AspNet.Server.Kestrel" +} diff --git a/samples/IISSample/project.json b/samples/IISSample/project.json index d5cc2e3da9..5912601362 100644 --- a/samples/IISSample/project.json +++ b/samples/IISSample/project.json @@ -3,12 +3,13 @@ "dependencies": { "Microsoft.AspNet.IISPlatformHandler": "1.0.0-*", "Microsoft.AspNet.Server.Kestrel": "1.0.0-*", - "Microsoft.AspNet.Server.WebListener": "1.0.0-*", "Microsoft.Extensions.Logging.Console": "1.0.0-*" }, + "compilationOptions": { + "emitEntryPoint": true + }, "commands": { - "web": "Microsoft.AspNet.Server.Kestrel", - "weblistener": "Microsoft.AspNet.Server.WebListener" + "web": "IISSample" }, "frameworks": { "dnx451": { }, diff --git a/test/Microsoft.AspNet.IISPlatformHandler.Tests/HttpPlatformHandlerMiddlewareTests.cs b/test/Microsoft.AspNet.IISPlatformHandler.Tests/HttpPlatformHandlerMiddlewareTests.cs index c63f66552a..c522fb6901 100644 --- a/test/Microsoft.AspNet.IISPlatformHandler.Tests/HttpPlatformHandlerMiddlewareTests.cs +++ b/test/Microsoft.AspNet.IISPlatformHandler.Tests/HttpPlatformHandlerMiddlewareTests.cs @@ -4,6 +4,7 @@ using System.Net.Http; using System.Threading.Tasks; using Microsoft.AspNet.Builder; +using Microsoft.AspNet.Hosting; using Microsoft.AspNet.Http.Features.Authentication; using Microsoft.AspNet.TestHost; using Xunit; @@ -17,18 +18,20 @@ namespace Microsoft.AspNet.IISPlatformHandler { var assertsExecuted = false; - var server = TestServer.Create(app => - { - app.UseIISPlatformHandler(); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - var auth = (IHttpAuthenticationFeature)context.Features[typeof(IHttpAuthenticationFeature)]; - Assert.NotNull(auth); - Assert.Equal("Microsoft.AspNet.IISPlatformHandler.AuthenticationHandler", auth.Handler.GetType().FullName); - assertsExecuted = true; - return Task.FromResult(0); + app.UseIISPlatformHandler(); + app.Run(context => + { + var auth = (IHttpAuthenticationFeature)context.Features[typeof(IHttpAuthenticationFeature)]; + Assert.NotNull(auth); + Assert.Equal("Microsoft.AspNet.IISPlatformHandler.AuthenticationHandler", auth.Handler.GetType().FullName); + assertsExecuted = true; + return Task.FromResult(0); + }); }); - }); + var server = new TestServer(builder); var req = new HttpRequestMessage(HttpMethod.Get, ""); await server.CreateClient().SendAsync(req); @@ -41,17 +44,19 @@ namespace Microsoft.AspNet.IISPlatformHandler { var assertsExecuted = false; - var server = TestServer.Create(app => - { - app.UseIISPlatformHandler(options => options.FlowWindowsAuthentication = false); - app.Run(context => + var builder = new WebApplicationBuilder() + .Configure(app => { - var auth = (IHttpAuthenticationFeature)context.Features[typeof(IHttpAuthenticationFeature)]; - Assert.Null(auth); - assertsExecuted = true; - return Task.FromResult(0); + app.UseIISPlatformHandler(options => options.FlowWindowsAuthentication = false); + app.Run(context => + { + var auth = (IHttpAuthenticationFeature)context.Features[typeof(IHttpAuthenticationFeature)]; + Assert.Null(auth); + assertsExecuted = true; + return Task.FromResult(0); + }); }); - }); + var server = new TestServer(builder); var req = new HttpRequestMessage(HttpMethod.Get, ""); await server.CreateClient().SendAsync(req);