本文整理匯總了C#中WebsitePanel.Providers.Web.WebServer.UpdateSite方法的典型用法代碼示例。如果您正苦於以下問題:C# WebServer.UpdateSite方法的具體用法?C# WebServer.UpdateSite怎麽用?C# WebServer.UpdateSite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WebsitePanel.Providers.Web.WebServer
的用法示例。
在下文中一共展示了WebServer.UpdateSite方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UpdateWebSite
public static int UpdateWebSite(WebSite site)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// load web site item
WebSite siteItem = (WebSite)PackageController.GetPackageItem(site.Id);
if (siteItem == null)
return BusinessErrorCodes.ERROR_WEB_SITE_PACKAGE_ITEM_NOT_FOUND;
// place log record
TaskManager.StartTask("WEB_SITE", "UPDATE", siteItem.Name);
TaskManager.ItemId = site.Id;
try
{
// update home folder
string origPath = site.ContentPath;
site.ContentPath = FilesController.GetFullPackagePath(site.PackageId, site.ContentPath);
// build data folder path
site.DataPath = siteItem.DataPath;
// update site on the service
WebServer web = new WebServer();
ServiceProviderProxy.Init(web, siteItem.ServiceId);
web.UpdateSite(site);
// Restore settings back
#region Web Deploy Settings
site.WebDeployPublishingAccount = siteItem.WebDeployPublishingAccount;
site.WebDeployPublishingPassword = siteItem.WebDeployPublishingPassword;
site.WebDeploySitePublishingEnabled = siteItem.WebDeploySitePublishingEnabled;
site.WebDeploySitePublishingProfile = siteItem.WebDeploySitePublishingProfile;
#endregion
// update service item
PackageController.UpdatePackageItem(site);
// set origpath
site.ContentPath = origPath;
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}