diff --git a/src/Umbraco.Web/Strategies/ServerRegistrationEventHandler.cs b/src/Umbraco.Web/Strategies/ServerRegistrationEventHandler.cs index 9760ec95fa..747a87ea1d 100644 --- a/src/Umbraco.Web/Strategies/ServerRegistrationEventHandler.cs +++ b/src/Umbraco.Web/Strategies/ServerRegistrationEventHandler.cs @@ -93,6 +93,7 @@ namespace Umbraco.Web.Strategies { try { + //var asdf = GetBindings(httpContext); var address = httpContext.Request.Url.GetLeftPart(UriPartial.Authority); applicationContext.Services.ServerRegistrationService.EnsureActive(address); } @@ -101,5 +102,40 @@ namespace Umbraco.Web.Strategies LogHelper.Error("Failed to update server record in database.", e); } } + + //private static IEnumerable> GetBindings(HttpContextBase context) + //{ + // // Get the Site name + // string siteName = System.Web.Hosting.HostingEnvironment.SiteName; + + // // Get the sites section from the AppPool.config + // Microsoft.Web.Administration.ConfigurationSection sitesSection = + // Microsoft.Web.Administration.WebConfigurationManager.GetSection(null, null, "system.applicationHost/sites"); + + // foreach (Microsoft.Web.Administration.ConfigurationElement site in sitesSection.GetCollection()) + // { + // // Find the right Site + // if (String.Equals((string)site["name"], siteName, StringComparison.OrdinalIgnoreCase)) + // { + + // // For each binding see if they are http based and return the port and protocol + // foreach (Microsoft.Web.Administration.ConfigurationElement binding in site.GetCollection("bindings")) + // { + // string protocol = (string)binding["protocol"]; + // string bindingInfo = (string)binding["bindingInformation"]; + + // if (protocol.StartsWith("http", StringComparison.OrdinalIgnoreCase)) + // { + // string[] parts = bindingInfo.Split(':'); + // if (parts.Length == 3) + // { + // string port = parts[1]; + // yield return new KeyValuePair(protocol, port); + // } + // } + // } + // } + // } + //} } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 19395f05e1..0445947441 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -117,6 +117,10 @@ ..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll + + True + ..\packages\Microsoft.Web.Administration.7.0.0.0\lib\net20\Microsoft.Web.Administration.dll + True ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll