Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何以编程方式(vb.net 或 C#)在 IIS7 的网站根目录中创建虚拟目录?
使用此链接,它仅向您展示如何在应用程序中创建一个,但我需要它在网站的根级别。
这在我的机器上工作(注意第二行的索引):
ServerManager iisManager = new ServerManager(); Application app = iisManager.Sites[0].Applications[0]; app.VirtualDirectories.Add("/VDir", "d:\\MyVDir"); iisManager.Update();