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;
                }

  • 相关阅读:
    php中 include 、include_once、require、require_once4个语言结构的含义和区别
    PHP yield 分析,以及协程的实现,超详细版(上)
    wordpress里的bloginfo()与get_bloginfo()
    CSS定位中“父相子绝”
    Apache 的 httpd.conf 详解
    apache的<directory>语句以及属性的含义
    你必须了解的Session的本质(PHP)
    Linux常用命令
    vmware中配置CentOS
    程序员可能会遇到的一些名词
  • 原文地址:https://www.cnblogs.com/greencolor/p/1792701.html
Copyright © 2011-2022 走看看