public virtual void Start()
{
Log.Info($"Starting website {ID}");
if (IsDisabled)
{
throw new InvalidOperationException("The {0} website is disabled. Open IIS Manager and remove _disabled suffix from its name in order to enable the website.");
}
using (WebServerManager.WebServerContext context = WebServerManager.CreateContext())
{
Site site = GetSite(context);
Assert.IsNotNull(site, "Site is missing");
ApplicationPool pool = GetPool(context);
Assert.IsNotNull(pool, nameof(pool));
if (!IsStarted(pool))
{
pool.Start();
context.CommitChanges();
}
}
using (WebServerManager.WebServerContext context = WebServerManager.CreateContext())
{
Site site = GetSite(context);
Assert.IsNotNull(site, "Site is missing");
if (!IsStarted(site))
{
site.Start();
context.CommitChanges();
}
}
}