代码如下:
const String constIISWebSiteRoot = "IIS://localhost/W3SVC/1/ROOT";
string physicalPath = FilePath;
DirectoryEntry root = new DirectoryEntry(constIISWebSiteRoot); DirectoryEntry tbEntry = root.Children.Add(VirtualName, root.SchemaClassName); tbEntry.Properties["Path"][0] = physicalPath;
tbEntry.Invoke("AppCreate", true); tbEntry.Properties["AccessRead"][0] = true;
tbEntry.Properties["ContentIndexed"][0] = true; ;
tbEntry.Properties["DefaultDoc"][0] = "index.asp,Default.aspx";
tbEntry.Properties["AppFriendlyName"][0] = VirtualName;
tbEntry.Properties["AccessScript"][0] = false;
tbEntry.Properties["DontLog"][0] = false;
//tbEntry.Properties["AuthFlags"][0] = 0;
//tbEntry.Properties["AuthFlags"][0] = 1;
tbEntry.CommitChanges();
const String constIISWebSiteRoot = "IIS://localhost/W3SVC/1/ROOT";
string physicalPath = FilePath;
DirectoryEntry root = new DirectoryEntry(constIISWebSiteRoot); DirectoryEntry tbEntry = root.Children.Add(VirtualName, root.SchemaClassName); tbEntry.Properties["Path"][0] = physicalPath;
tbEntry.Invoke("AppCreate", true); tbEntry.Properties["AccessRead"][0] = true;
tbEntry.Properties["ContentIndexed"][0] = true; ;
tbEntry.Properties["DefaultDoc"][0] = "index.asp,Default.aspx";
tbEntry.Properties["AppFriendlyName"][0] = VirtualName;
tbEntry.Properties["AccessScript"][0] = false;
tbEntry.Properties["DontLog"][0] = false;
//tbEntry.Properties["AuthFlags"][0] = 0;
//tbEntry.Properties["AuthFlags"][0] = 1;
tbEntry.CommitChanges();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货