views:

45

answers:

0

Hello,

I created a windows Service app which knows how to create virtual directories in the root folder of the IIS (7.5).

And this is the code:

System.EnterpriseServices.Internal.IISVirtualRoot vr = new System.EnterpriseServices.Internal.IISVirtualRoot();

string sError = "";

vr.Create("IIS://localhost/W3SVC/1/Root", physicalPath, virtualDirectoryName, out sError);

This works perfecly.

Now, lets say I created a virtual dir named MyVDir within the ROOT folder, and then I want to create another virtual dir, with the same c# function as above - within the MyVDir virtual directory (create nested virtual directory). What should I do?

Something like vr.Create("IIS://localhost/W3SVC/1/Root/MyVDir", physicalPath, virtualDirectoryName, out sError); doesn't work for me, and throws an 'Cannot find path' exception.

Thanks all!