开发者

Creating virtual directories within another virtual directory using C#

开发者 https://www.devze.com 2023-01-09 00:13 出处:网络
开发者_如何学PythonI created a windows Service app which knows how to create virtual directories in the root folder of the IIS (7.5).

开发者_如何学PythonI 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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号