Connecting Tech Pros Worldwide Forums | Help | Site Map

Creating IIS virtual directory usin C#

sudhapadmas@yahoo.com
Guest
 
Posts: n/a
#1: May 26 '06
Hello netters,

I was trying to create a virtual directory in IIS using the following
code:

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

string sError;
vr.Create("IIS://localhost/W3SVC/1/Root",@"C:\Program
Files\Soft","WebServices",out sError);
Console.WriteLine(sError);


But I am getting following errors:

System.Runtime.InteropServices.COMException (0x80070003): The system
cannot find the path specified
at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsCont ainer()
at System.DirectoryServices.DirectoryEntries.CheckIsC ontainer()
at System.DirectoryServices.DirectoryEntries.Add(Stri ng name, String
schemaClassName)
at System.EnterpriseServices.Internal.IISVirtualRoot. Create(String
RootWeb, String inPhysicalDirectory, String VirtualDirectory,
String&.....


I even tried to create virtual directory using System.DirectoryEntry.
It gives me the same error.
Iam sure C:\Program Files\Soft exists . I am doubtful if Iam making
some mistake in passing first parameter.

Can Somebody please tell me what is going wrong?

Thanking you in advance,

Sudha


Closed Thread