本文整理汇总了C#中WebsitePanel.Providers.Web.WebServer.UninstallFrontPage方法的典型用法代码示例。如果您正苦于以下问题:C# WebServer.UninstallFrontPage方法的具体用法?C# WebServer.UninstallFrontPage怎么用?C# WebServer.UninstallFrontPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebsitePanel.Providers.Web.WebServer
的用法示例。
在下文中一共展示了WebServer.UninstallFrontPage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UninstallFrontPage
public static int UninstallFrontPage(int siteItemId)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// load site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// place log record
TaskManager.StartTask("WEB_SITE", "UNINSTALL_FP", siteItem.Name);
TaskManager.ItemId = siteItemId;
TaskManager.WriteParameter("FrontPage username", siteItem.FrontPageAccount);
try
{
if (String.IsNullOrEmpty(siteItem.FrontPageAccount))
siteItem.FrontPageAccount = GetFrontPageUsername(siteItem.Name);
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
web.UninstallFrontPage(siteItem.SiteId, siteItem.FrontPageAccount);
// update site with FP account
siteItem.FrontPageAccount = "";
PackageController.UpdatePackageItem(siteItem);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
示例2: DeleteWebSite
public static int DeleteWebSite(int siteItemId)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// load web site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// place log record
TaskManager.StartTask("WEB_SITE", "DELETE", siteItem.Name);
TaskManager.ItemId = siteItemId;
// delete web site
try
{
// remove all web site pointers
List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
foreach (DomainInfo pointer in pointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, false);
// remove web site main pointer
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
if(domain != null)
DeleteWebSitePointer(siteItemId, domain.DomainId, false);
// delete web site
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
#region Fix for bug #710
//
if (web.IsFrontPageSystemInstalled() && web.IsFrontPageInstalled(siteItem.SiteId))
{
web.UninstallFrontPage(siteItem.SiteId, siteItem.FrontPageAccount);
}
#endregion
//
web.DeleteSite(siteItem.SiteId);
// delete service item
PackageController.DeletePackageItem(siteItemId);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
示例3: DeleteWebSite
public static int DeleteWebSite(int siteItemId, bool deleteWebsiteDirectory)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// load web site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(siteItemId);
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// place log record
TaskManager.StartTask("WEB_SITE", "DELETE", siteItem.Name, siteItemId);
// delete web site
try
{
//cleanup certificates
//cleanup certificates
List<SSLCertificate> certificates = GetCertificatesForSite(siteItemId);
foreach (SSLCertificate c in certificates)
{
DeleteCertificate(siteItemId, c);
}
// remove all web site pointers
List<DomainInfo> pointers = GetWebSitePointers(siteItemId);
foreach (DomainInfo pointer in pointers)
DeleteWebSitePointer(siteItemId, pointer.DomainId, false, true, true);
// remove web site main pointer
DomainInfo domain = ServerController.GetDomain(siteItem.Name);
if(domain != null)
DeleteWebSitePointer(siteItemId, domain.DomainId, false, true, true);
List<WebSite> sites = WebServerController.GetWebSites(domain.PackageId, false);
bool oneSiteOnly = (sites.Count == 1);
if (oneSiteOnly)
{
// load site item
IPAddressInfo ip = ServerController.GetIPAddress(sites[0].SiteIPAddressId);
string serviceIp = (ip != null) ? ip.ExternalIP : null;
if (string.IsNullOrEmpty(serviceIp))
{
StringDictionary settings = ServerController.GetServiceSettings(sites[0].ServiceId);
if (settings["PublicSharedIP"] != null)
serviceIp = settings["PublicSharedIP"].ToString();
}
ServerController.RemoveServiceDNSRecords(domain.PackageId, ResourceGroups.Web, domain, serviceIp, true);
}
// delete web site
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
//
if (web.IsFrontPageSystemInstalled() && web.IsFrontPageInstalled(siteItem.SiteId))
{
web.UninstallFrontPage(siteItem.SiteId, siteItem.FrontPageAccount);
}
//
web.DeleteSite(siteItem.SiteId);
// Delete WebManagementAccess Account
WebServerController.RevokeWebManagementAccess(siteItemId);
if (deleteWebsiteDirectory)
{
// Delete website directory from file server
// This will remove the hard quota as well
FilesController.DeleteDirectoryRecursive(siteItem.PackageId, new DirectoryInfo(siteItem.DataPath).Parent.FullName);
}
// delete service item
PackageController.DeletePackageItem(siteItemId);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}