我正在尋找一種方法來在默認網站中創建具有Microsoft.Web.Administration的虛擬目錄,但不創建應用程序。IIS:如何使用Microsoft.Web.Administration在網站上創建虛擬目錄
我發現的唯一途徑,創建應用程序:
Microsoft.Web.Administration.ServerManager manager = new Microsoft.Web.Administration.ServerManager();
Site defaultSite = manager.Sites[ "Default Web Site];
Microsoft.Web.Administration.Application app =
defaultSite.Applications.Add("\virtDir", "c:\\path");
manager.CommitChanges();
請查看以下鏈接: [http://stackoverflow.com/questions/1755316/creating-virtual-directory-in-iis-7 -0-using-c-net] [1] [1]:http://stackoverflow.com/questions/1755316/creating-virtual-directory-in-iis-7-0-using-c-net – 2012-05-09 05:31:01