diff --git a/samples/IISSample/Properties/launchSettings.json b/samples/IISSample/Properties/launchSettings.json index 1c953e10f0..009aa9ab89 100644 --- a/samples/IISSample/Properties/launchSettings.json +++ b/samples/IISSample/Properties/launchSettings.json @@ -12,7 +12,8 @@ "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Server.IISIntegration" } }, "IISSample": { @@ -24,4 +25,4 @@ } } } -} +} \ No newline at end of file diff --git a/samples/IISSample/Startup.cs b/samples/IISSample/Startup.cs index 18a59348fa..8f033dd297 100644 --- a/samples/IISSample/Startup.cs +++ b/samples/IISSample/Startup.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Linq; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -76,7 +76,6 @@ namespace IISSample { var host = new WebHostBuilder() .UseKestrel() - .UseIISIntegration() .UseStartup() .Build(); diff --git a/src/Microsoft.AspNetCore.Server.IISIntegration/IISHostingStartup.cs b/src/Microsoft.AspNetCore.Server.IISIntegration/IISHostingStartup.cs new file mode 100644 index 0000000000..9e79a7e1aa --- /dev/null +++ b/src/Microsoft.AspNetCore.Server.IISIntegration/IISHostingStartup.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Hosting; + +[assembly: HostingStartup(typeof(Microsoft.AspNetCore.Server.IISIntegration.IISHostingStartup))] + +namespace Microsoft.AspNetCore.Server.IISIntegration +{ + public class IISHostingStartup : IHostingStartup + { + public void Configure(IWebHostBuilder builder) + { + builder.UseIISIntegration(); + } + } +}