C 操作IIS方法集合

2021-09-08 04:54:45 字數 2205 閱讀 5803

如果在win8,win7情況下報錯:未知錯誤(0x80005000)

using system;

using system.collections;

using system.collections.generic;

using system.directoryservices;

using system.linq;

using system.net;

using system.text;

using system.threading.tasks;

namespace iiscontrolhelper

catch (exception se)

}/// /// 建立虛擬目錄**

///

/// **名稱

/// 物理路徑

/// 站點+埠,如192.168.1.23:90

/// }}

// 建立web站點

directoryentry site = (directoryentry)root.invoke("create", "iiswebserver", siteid);

site.invoke("put", "servercomment", websitename);

site.invoke("put", "keytype", "iiswebserver");

site.invoke("put", "serverbindings", domainport + ":");

site.invoke("put", "serverstate", 2);

site.invoke("put", "frontpageweb", 1);

site.invoke("put", "defaultdoc", "default.html");

// site.invoke("put", "securebindings", ":443:");

site.invoke("put", "serverautostart", 1);

site.invoke("put", "serversize", 1);

site.invoke("setinfo");

// 建立應用程式虛擬目錄

directoryentry sitevdir = site.children.add("root", "iiswebvirtualdir");

sitevdir.properties["path"][0] = physicalpath;

sitevdir.properties["accessflags"][0] = 513;

sitevdir.properties["frontpageweb"][0] = 1;

sitevdir.commitchanges();

site.commitchanges();

return siteid;

}/// /// 得到**的物理路徑

///

/// **節點

///

public static string getwebsitephysicalpath(directoryentry rootentry)

else}}

return physicalpath;

}/// /// 獲取站點名

///

public static listgetserverbindings()

/w3svc", hostname);

directoryentry ent = new directoryentry(entpath);

foreach (directoryentry child in ent.children)

else//只有乙個繫結站點

iisinfo iisinfo = new iisinfo();

iisinfo.domainport = serverbindingstr;

iislist.add(iisinfo);}}

}return iislist;

}catch // (exception ex)

}/// /// 建立程式池後關聯相應應用程式及虛擬目錄

/// }}

}}}}

/// /// 判斷object物件是否為陣列

///

public static bool isarray(object o)

}}

C 操作IIS方法集合

如果在win8,win7情況下報錯 未知錯誤 0x80005000 見using system using system.collections using system.collections.generic using system.directoryservices using system....

C 操作IIS方法集合

如果在win8,win7情況下報錯 未知錯誤 0x80005000 見using system using system.collections using system.collections.generic using system.directoryservices using system....

C 操作IIS方法集合

如果在win8,win7情況下報錯 未知錯誤 0x80005000 見using system using system.collections using system.collections.generic using system.directoryservices using system....