ttnetworks
asked on
Edit the Default IIS Website Path
Hi,
As part of an application I am developing, I need to change the path of the Default IIS website when the software is installed.
This appeared to be quite easy after some searching, but the code I have is returning an "Unknown Error"
Code:
public static void Configure()
{
DirectoryEntry objDEParent = new DirectoryEntry(@"IIS://loc alhost/LM/ W3SVC/1/RO OT/");
objDEParent.Properties["Pa th"][0] = @"C:\Web";
objDEParent.CommitChanges( );
}
Error:
Unhandled Exception: System.Runtime.InteropServ ices.COMEx ception (0x80005000): Unknown error (0x80005000)
at System.DirectoryServices.D irectoryEn try.Bind(B oolean throwIfFail)
at System.DirectoryServices.D irectoryEn try.Bind()
at System.DirectoryServices.D irectoryEn try.get_Ad sObject()
at System.DirectoryServices.P ropertyVal ueCollecti on.Populat eList()
at System.DirectoryServices.P ropertyVal ueCollecti on..ctor(D irectoryEn try entry, String propertyName)
at System.DirectoryServices.P ropertyCol lection.ge t_Item(Str ing propertyName)
All I need to to do is change the Document path for the default IIS website so it points to the folder our software is installed in.
Thanks
Andrew
As part of an application I am developing, I need to change the path of the Default IIS website when the software is installed.
This appeared to be quite easy after some searching, but the code I have is returning an "Unknown Error"
Code:
public static void Configure()
{
DirectoryEntry objDEParent = new DirectoryEntry(@"IIS://loc
objDEParent.Properties["Pa
objDEParent.CommitChanges(
}
Error:
Unhandled Exception: System.Runtime.InteropServ
at System.DirectoryServices.D
at System.DirectoryServices.D
at System.DirectoryServices.D
at System.DirectoryServices.P
at System.DirectoryServices.P
at System.DirectoryServices.P
All I need to to do is change the Document path for the default IIS website so it points to the folder our software is installed in.
Thanks
Andrew
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm surprised you're still getting the error while I'm able to run the code on the same XP Pro with SP2 and of course IIS 5.1 without any problem.
Just for testing, can you run this code?
DirectoryEntry de = new DirectoryEntry(@"IIS://loc alhost/W3s vc/1/Root" );
Console.WriteLine(de.Prope rties["Pat h"].Value) ;
foreach ( String s in de.Properties.PropertyName s )
{
Console.WriteLine(s);
}
Just for testing, can you run this code?
DirectoryEntry de = new DirectoryEntry(@"IIS://loc
Console.WriteLine(de.Prope
foreach ( String s in de.Properties.PropertyName
{
Console.WriteLine(s);
}
ASKER
Hi,
Yep that code runs OK.
Andrew
Yep that code runs OK.
Andrew
ASKER
Hi,
All working now, those / make a big difference :-)
Thanks for the help.
Andrew
All working now, those / make a big difference :-)
Thanks for the help.
Andrew
ASKER
Nope. Reports the same error.
This is on a Windows XP Pro SP2 Machine, which uses IIS 5.1 ?
Thanks
Andrew