zoukankan      html  css  js  c++  java
  • Del site

      string SiteID = null;
                DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC");
               
                    foreach (DirectoryEntry child in root.Children)
                    {
                        if (child.SchemaClassName == "IIsWebServer")
                        {
                            if (WebSiteName == child.Properties["servercomment"].Value.ToString())
                            {
                                 SiteID = child.Name.ToString();
                            }
                        }
                    }          
                try
                {
                    if (SiteID == null) return "error:该站点不存在.";

                    DirectoryEntry deRoot = new DirectoryEntry("IIS://localhost/W3SVC");
                    try
                    {
                        DirectoryEntry deVDir = new DirectoryEntry();
                        deRoot.RefreshCache();
                        deVDir = deRoot.Children.Find(SiteID, "IIsWebServer");
                        deRoot.Children.Remove(deVDir);

                        deRoot.CommitChanges();
                        deRoot.Close();
                        return "successful:删除站点" + WebSiteName + "成功!";
                    }
                    catch (System.Exception)
                    {
                        return "error:该站点不存在.";
                    }
                }
                catch (Exception e)
                {
                    return "error:删除站点失败." + e.Message;
                }

  • 相关阅读:
    Yarn的运行原理(执行流程)
    Hive 表类型简述
    hive 表类型
    Hadoop小知识点总结1
    电商交易项目案例
    乘用车辆和商用车辆销售数据分析
    搜狗搜索日志分析系统
    mysql group by 对多个字段进行分组
    group by
    输出GPLT
  • 原文地址:https://www.cnblogs.com/greencolor/p/1792701.html
Copyright © 2011-2022 走看看