Skip to content
This repository was archived by the owner on Nov 1, 2018. It is now read-only.

Added extension method to handle the HTTP_PLATFORM_PORT #60

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;

namespace Microsoft.AspNet.Hosting
{
public static class IISWebApplicationBuilderExtensions
{
public static IWebApplicationBuilder UseIISPlatformHandler(this IWebApplicationBuilder webApplicationBuilder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IWebApplicationBuilder.UseIISPlatformHandler needs to be searchably distinct from IApplicationBuilder.UseIISPlatformHandler. UseIISPlatformHandlerUrl?

{
var httpPlatformPort = Environment.GetEnvironmentVariable("HTTP_PLATFORM_PORT");

if (string.IsNullOrEmpty(httpPlatformPort))
{
return webApplicationBuilder;
}

return webApplicationBuilder.UseSetting(WebApplicationDefaults.ServerUrlsKey, $"http://localhost:{httpPlatformPort}/");
}
}
}
1 change: 1 addition & 0 deletions src/Microsoft.AspNet.IISPlatformHandler/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"url": "git://github.com/aspnet/IISIntegration"
},
"dependencies": {
"Microsoft.AspNet.Hosting.Abstractions": "1.0.0-*",
"Microsoft.AspNet.Http": "1.0.0-*",
"Microsoft.AspNet.Http.Extensions": "1.0.0-*",
"Microsoft.Extensions.SecurityHelper.Sources": {
Expand Down
4 changes: 3 additions & 1 deletion test/TestSites/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ public static class Program
{
public static void Main(string[] args)
{
var hostingConfiguration = WebApplicationConfiguration.GetDefault(args);
var application = new WebApplicationBuilder()
.UseConfiguration(WebApplicationConfiguration.GetDefault(args))
.UseIISPlatformHandler()
.UseConfiguration(hostingConfiguration)
.UseStartup("TestSites")
.Build();

Expand Down