请教各位同仁
虚拟目录的创建已搞掂。
不知道如何用C#动态创建IIS的WEB站点,而不是虚拟目录?
谢谢各位捧场的。

解决方案 »

  1.   

    可以进http://www.9i5e.com/Companys.aspx 看看,个人觉的不错的例子
      

  2.   

    参看
    http://www.codeproject.com/vb/net/VDirViewer.asp
      

  3.   

    兄弟们,遇到新问题
    在运行下面代码时
                               string HostName="192.168.8.118:80";
    string entPath = String.Format("IIS://{0}/w3svc", HostName);
    DirectoryEntry ent = GetDirectoryEntry(entPath);
       
    foreach(DirectoryEntry child in ent.Children)
    {
    if(child.SchemaClassName == "IIsWebServer")
    {
    if(child.Properties["ServerBindings"].Value != null)
    {
    tmpStr = child.Properties["ServerBindings"].Value.ToString();
    if(regex.Match(tmpStr).Success)
    {
    return child.Name;
    }
    } if(child.Properties["ServerComment"].Value != null)
    {
    tmpStr = child.Properties["ServerComment"].Value.ToString();
    if(regex.Match(tmpStr).Success)
    {
    return child.Name;
    }
    }
    }
    }
    运行到ent.Children,系统抛出未知错误(0x80005000)
    请兄弟们帮我看看
    谢谢了
      

  4.   

    补充GetDirectoryEntry方法代码
    public static DirectoryEntry GetDirectoryEntry(string entPath)
    {
    DirectoryEntry ent; ent = new DirectoryEntry(entPath); return ent;
    }