From ef9cc2da3a3dd66acb56c8fc0e894ce5bc050193 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 27 Mar 2015 12:58:04 +1100 Subject: [PATCH] removes WebServerUtility since that original code was only for azure website dist cache when using web services and server registrars (POC) so we also don't need the extra nuget ref either. --- src/Umbraco.Web/Umbraco.Web.csproj | 5 -- src/Umbraco.Web/WebServerUtility.cs | 79 ----------------------------- src/Umbraco.Web/packages.config | 1 - 3 files changed, 85 deletions(-) delete mode 100644 src/Umbraco.Web/WebServerUtility.cs diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 9c9405accd..1570bbfb2f 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -132,10 +132,6 @@ ..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll - - ..\packages\Microsoft.Web.Administration.7.0.0.0\lib\net20\Microsoft.Web.Administration.dll - True - True ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll @@ -1892,7 +1888,6 @@ True Reference.map - diff --git a/src/Umbraco.Web/WebServerUtility.cs b/src/Umbraco.Web/WebServerUtility.cs deleted file mode 100644 index 7ea9e8ea25..0000000000 --- a/src/Umbraco.Web/WebServerUtility.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web.Hosting; -using Umbraco.Core; -using Microsoft.Web.Administration; - -namespace Umbraco.Web -{ - internal class WebServerUtility - { - // NOTE - // - // there's some confusion with Microsoft.Web.Administration versions - // 7.0.0.0 is installed by NuGet and will read IIS settings - // 7.9.0.0 comes with IIS Express and will read IIS Express - // we want to use 7.0.0.0 when building - // and then... there are further versions that are N/A on NuGet - // - // Umbraco uses 7.0.0.0 from NuGet - // IMPORTANT: and then, the reference's SpecificVersion property MUST be set to true - // otherwise we might build with 7.9.0.0 and end up in troubles (reading IIS Express - // instead of IIS even when running IIS) - IIS Express has a binding redirect from - // 7.0.0.0 to 7.9.0.0 so it's fine. - // - // read: - // http://stackoverflow.com/questions/11208270/microsoft-web-administration-servermanager-looking-in-wrong-directory-for-iisexp - // http://stackoverflow.com/questions/8467908/how-to-use-servermanager-to-read-iis-sites-not-iis-express-from-class-library - // http://stackoverflow.com/questions/25812169/microsoft-web-administration-servermanager-is-connecting-to-the-iis-express-inst - - public static IEnumerable GetBindings() - { - // FIXME - // which of these methods shall we use? - // what about permissions, trust, etc? - - //return GetBindings2(); - throw new NotImplementedException(); - } - - private static IEnumerable GetBindings1() - { - // get the site name - var siteName = HostingEnvironment.SiteName; - - // get the site from the sites section from the AppPool.config - var sitesSection = WebConfigurationManager.GetSection(null, null, "system.applicationHost/sites"); - var site = sitesSection.GetCollection().FirstOrDefault(x => ((string) x["name"]).InvariantEquals(siteName)); - if (site == null) - return Enumerable.Empty(); - - return site.GetCollection("bindings") - .Where(x => ((string) x["protocol"]).StartsWith("http", StringComparison.OrdinalIgnoreCase)) - .Select(x => - { - var bindingInfo = (string) x["bindingInformation"]; - var parts = bindingInfo.Split(':'); // can count be != 3 ?? - return new Uri(x["protocol"] + "://" + parts[2] + ":" + parts[1] + "/"); - }); - } - - private static IEnumerable GetBindings2() - { - // get the site name - var siteName = HostingEnvironment.SiteName; - - // get the site from the server manager - var mgr = new ServerManager(); - var site = mgr.Sites.FirstOrDefault(x => x.Name.InvariantEquals(siteName)); - if (site == null) - return Enumerable.Empty(); - - // get the bindings - return site.Bindings - .Where(x => x.Protocol.StartsWith("http", StringComparison.OrdinalIgnoreCase)) - .Select(x => new Uri(x.Protocol + "://" + x.Host + ":" + x.EndPoint.Port + "/")); - } - } -} diff --git a/src/Umbraco.Web/packages.config b/src/Umbraco.Web/packages.config index f624d5b6d5..b08c9193ee 100644 --- a/src/Umbraco.Web/packages.config +++ b/src/Umbraco.Web/packages.config @@ -17,7 +17,6 @@ -