+++++++++++50分问一个问题!++++++++++++

zhangyunjian1 2005-02-27 07:07:11
如何使用asp.net操作iis 新建一个站点, 并且设置站点的属性! 站点文件的目录!


在线等!!
...全文
122 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
njuzgj 2005-02-28
  • 打赏
  • 举报
回复
帮顶
lonelydreamsym 2005-02-28
  • 打赏
  • 举报
回复
up
aa2004 2005-02-27
  • 打赏
  • 举报
回复
up
ldljlq 2005-02-27
  • 打赏
  • 举报
回复
public class SetupUtility{public SetupUtility(){}public int CreateWebSite(string webSiteName, string pathToRoot){return CreateWebSite(webSiteName, pathToRoot, false);}public int CreateWebSite(string webSiteName, string pathToRoot, bool createDir){DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC");// Find unused ID value for new web siteint siteID = 1;foreach(DirectoryEntry e in root.Children){if(e.SchemaClassName == "IIsWebServer"){int ID = Convert.ToInt32(e.Name);if(ID >= siteID){siteID = ID+1;}}}// Create web siteDirectoryEntry site = (DirectoryEntry)root.Invoke("Create", "IIsWebServer", siteID);site.Invoke("Put", "ServerComment", webSiteName);site.Invoke("Put", "KeyType", "IIsWebServer");site.Invoke("Put", "ServerBindings", ":80:");site.Invoke("Put", "ServerState", 2);site.Invoke("Put", "FrontPageWeb", 1);site.Invoke("Put", "DefaultDoc", "Default.aspx");site.Invoke("Put", "SecureBindings", ":443:");site.Invoke("Put", "ServerAutoStart", 1);site.Invoke("Put", "ServerSize", 1);site.Invoke("SetInfo");// Create application virtual directoryDirectoryEntry siteVDir = site.Children.Add("Root", "IISWebVirtualDir");siteVDir.Properties["AppIsolated"][0] = 2;siteVDir.Properties["Path"][0] = pathToRoot;siteVDir.Properties["AccessFlags"][0] = 513;siteVDir.Properties["FrontPageWeb"][0] = 1;siteVDir.Properties["AppRoot"][0] = "LM/W3SVC/"+siteID+"/Root";siteVDir.Properties["AppFriendlyName"][0] = "Root";siteVDir.CommitChanges();site.CommitChanges();return siteID;}}
zhangyunjian1 2005-02-27
  • 打赏
  • 举报
回复
up up up up up up up up up up up up up up up up up up
zhangyunjian1 2005-02-27
  • 打赏
  • 举报
回复
up
zhangyunjian1 2005-02-27
  • 打赏
  • 举报
回复
不要操作虚拟目录 要新建站点 的!
yizhixiaozhu 2005-02-27
  • 打赏
  • 举报
回复
up
web_gus 2005-02-27
  • 打赏
  • 举报
回复
http://www.21tx.com/school/dotnet/csharp/37WYKIJNZZMW1NJCHS.shtml
web_gus 2005-02-27
  • 打赏
  • 举报
回复
http://www.21tx.com/school/dotnet/csharp/37WYKIJNZZMX1NJCHS.shtml

http://www.knowsky.com/4185.html
qzb0818 2005-02-27
  • 打赏
  • 举报
回复
ding

62,266

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧