如何从IIS中删除虚拟目录条目?

发布于 2024-09-30 03:28:52 字数 143 浏览 0 评论 0原文

我已经编写了一些代码来删除虚拟目录,但是它所做的只是删除了虚拟目录下的文件夹结构,而不是 IIS 中的实际虚拟条目,因此,如果我打开 IIS,我仍然可以看到默认 Web 下的列表地点。

如何在删除虚拟站点的同时删除条目,以便在“默认网站”下不列出任何内容?

I have written some code to delete Virtual Directories, however all that it is doing is that it deleted the folder structures beneath the Virtuals and not the actual virtual entries in IIS, so that if I open IIS I can still see the listings under Default Web Site.

How does one delete virtual while also deleting the entries so that nothing is listed under Default Web Site?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

另类 2024-10-07 03:28:52

这应该适用于 IIS6(元数据库配置系统)和 IIS7(基于 xml 的配置系统):

string vDirPath = "IIS://localhost/W3SVC/<siteIndex>/ROOT/<vdirName>";
DirectoryEntry vDir = new DirectoryEntry(vDirPath);
vDir.DeleteTree();

其中 siteIndex 是站点的索引,vdirName 是 vdir 的名称。

This should work for both IIS6 (metabase config system) and IIS7 (xml-based config system):

string vDirPath = "IIS://localhost/W3SVC/<siteIndex>/ROOT/<vdirName>";
DirectoryEntry vDir = new DirectoryEntry(vDirPath);
vDir.DeleteTree();

where siteIndex is an index of your site and vdirName is the name of your vdir.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文