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.
Those virtual d开发者_高级运维irectories 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.
MY GOAL, is to create those virtual directories, whithin subfolders of my other web-application.
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)
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. Lets take Site1 as an example.
/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.
精彩评论