Prework switch web dedicated to shared

Dedicated sites supports now hostheaders
This commit is contained in:
robvde 2012-09-18 22:50:00 +04:00
parent 465731273a
commit 6868241a6d
15 changed files with 358 additions and 318 deletions

View file

@ -1237,7 +1237,7 @@ namespace WebsitePanel.Providers.Web
// Create site
webObjectsSvc.CreateSite(site);
// Update web site bindings
webObjectsSvc.UpdateSiteBindings(site.SiteId, site.Bindings);
webObjectsSvc.UpdateSiteBindings(site.SiteId, site.Bindings, false);
// Set web site logging settings
webObjectsSvc.SetWebSiteLoggingSettings(site);
}
@ -1322,7 +1322,7 @@ namespace WebsitePanel.Providers.Web
// Update website
webObjectsSvc.UpdateSite(site);
// Update website bindings
webObjectsSvc.UpdateSiteBindings(site.SiteId, site.Bindings);
webObjectsSvc.UpdateSiteBindings(site.SiteId, site.Bindings, false);
// Set website logging settings
webObjectsSvc.SetWebSiteLoggingSettings(site);
//
@ -1440,9 +1440,9 @@ namespace WebsitePanel.Providers.Web
/// </summary>
/// <param name="siteId">Site's id to update bindings for.</param>
/// <param name="bindings">Bindings information.</param>
public override void UpdateSiteBindings(string siteId, ServerBinding[] bindings)
public override void UpdateSiteBindings(string siteId, ServerBinding[] bindings, bool emptyBindingsAllowed)
{
this.webObjectsSvc.UpdateSiteBindings(siteId, bindings);
this.webObjectsSvc.UpdateSiteBindings(siteId, bindings, emptyBindingsAllowed);
}
/// <summary>

View file

@ -422,11 +422,14 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
return bindings.ToArray();
}
private void SyncWebSiteBindingsChanges(string siteId, ServerBinding[] bindings)
private void SyncWebSiteBindingsChanges(string siteId, ServerBinding[] bindings, bool emptyBindingsAllowed)
{
// ensure site bindings
if (bindings == null || bindings.Length == 0)
throw new Exception("SiteServerBindingsEmpty");
if (!emptyBindingsAllowed)
{
if (bindings == null || bindings.Length == 0)
throw new Exception("SiteServerBindingsEmpty");
}
using (var srvman = GetServerManager())
{
@ -461,7 +464,7 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
}
}
public void UpdateSiteBindings(string siteId, ServerBinding[] bindings)
public void UpdateSiteBindings(string siteId, ServerBinding[] bindings, bool emptyBindingsAllowed)
{
using (ServerManager srvman = GetServerManager())
{
@ -470,7 +473,7 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
return;
}
//
SyncWebSiteBindingsChanges(siteId, bindings);
SyncWebSiteBindingsChanges(siteId, bindings, emptyBindingsAllowed);
}
public string GetPhysicalPath(ServerManager srvman, WebVirtualDirectory virtualDir)