public void SetupIIS() { if (iisManager.SiteExists(testSiteName)) { iisManager.DeleteSite(testSiteName); } iisManager.CreateSite(testSiteName, testSiteDomain, PrimaryIISRoot, "DefaultAppPool"); Assert.IsTrue(iisManager.SiteExists(testSiteName)); }
/// <summary> /// 尝试创建升级中转站 /// </summary> public void TryCreateUpgradeTransferSite(Site siteInfo) { try { if (siteInfo == null) { throw new ArgumentNullException("siteinfo is null"); } var rootPath = AppDomain.CurrentDomain.BaseDirectory; siteInfo.PhysicalPath = $"{rootPath}" + siteInfo.PhysicalPath; IISManager.CreateSite(siteInfo); Clients.All.tranfersitecallback(new { success = true, msg = "站点创建成功", url = siteInfo.DefaultPage }); } catch (Exception ex) { Logger.Error(ex.Message, ex); Clients.All.tranfersitecallback(new { success = false, msg = ex.Message }); } }