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.

This commit is contained in:
Shannon
2015-03-27 12:58:04 +11:00
parent 12fd5c642d
commit ef9cc2da3a
3 changed files with 0 additions and 85 deletions

View File

@@ -132,10 +132,6 @@
<HintPath>..\packages\Lucene.Net.2.9.4.1\lib\net40\Lucene.Net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.Administration.7.0.0.0\lib\net20\Microsoft.Web.Administration.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
@@ -1892,7 +1888,6 @@
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<Compile Include="WebServerUtility.cs" />
<Compile Include="WebServices\BulkPublishController.cs" />
<Compile Include="WebServices\CoreStringsController.cs" />
<Compile Include="WebServices\DomainsApiController.cs" />

View File

@@ -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<Uri> GetBindings()
{
// FIXME
// which of these methods shall we use?
// what about permissions, trust, etc?
//return GetBindings2();
throw new NotImplementedException();
}
private static IEnumerable<Uri> 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<Uri>();
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<Uri> 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<Uri>();
// 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 + "/"));
}
}
}

View File

@@ -17,7 +17,6 @@
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.Web.Administration" version="7.0.0.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />