简体   繁体   English

在IIS 7.5 \\ C#(.NET v4.0)中创建嵌套虚拟目录

[英]Creating nested virtual directories in IIS 7.5 \ C# (.NET v4.0)

I created a Windows Service, with a constant interval that checks few lines in the DB, and creates virtual directories in the IIS by code. 我创建了一个Windows服务,该服务具有固定的时间间隔,该时间间隔检查数据库中的几行,并通过代码在IIS中创建虚拟目录。

Those virtual directories are created in the following template: 这些虚拟目录在以下模板中创建:

"IIS://localhost/W3SVC/1/Root/" + vdName

As written, virtual directories are created successfully, but in the ROOT folder of my website in IIS. 按照书面说明,虚拟目录创建成功,但是在IIS中我网站的ROOT文件夹中。

MY GOAL, is to create those virtual directories, whithin subfolders of my other web-application. 我的目标是创建那些虚拟目录,以及我的其他Web应用程序的子文件夹。

What should be the correct path? 正确的路径应该是什么? I guess it should be something like the following: 我猜应该是这样的:

"IIS://localhost/W3SVC/1/Root/[AnotherVirtualDir]/subDir1/subDir2/" + vdName

But this offcourse, doesn't work :) 但是这种说法是行不通的:)

(.NET v4.0, IIS 7.5, Windows 2008 R2) (.NET v4.0,IIS 7.5,Windows 2008 R2)

Thanks in advance! 提前致谢!

Gal. 加尔

I think what you need is a Site with some tree of directories where the virtual directories are leaves on the tree. 我认为您需要的是一个带有一些目录树的站点,其中虚拟目录留在树上。

If your web files are located at '/ROOT/' you can have multiple IIS sites pointing to different folders. 如果您的Web文件位于“ / ROOT /”,则可以有多个IIS站点指向不同的文件夹。 Lets take Site1 as an example. 让我们以Site1为例。

/Root/Site1/

This site can have an array of folders. 该站点可以具有一系列文件夹。

/Root/Site1/Sub1/
/Root/Site1/Sub2/

You can then put your virtual directories in those. 然后,您可以将虚拟目录放在这些目录中。

/Root/Site1/Sub1/VirtualDir1/
/Root/Site1/Sub1/VirtualDir2/
/Root/Site1/Sub2/VirtualDir3/
/Root/Site1/Sub2/VirtualDir4/

You can do a similar structure in a separate site. 您可以在单独的站点中执行类似的结构。 Having a site with a virtual directory is very similar to nested virtual directories. 具有虚拟目录的站点与嵌套虚拟目录非常相似。

The objective is to avoid nested virtual directories by using plain sub-directories or multiple sites. 目的是通过使用纯子目录或多个站点来避免嵌套虚拟目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM