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"
public static void Configure()
DirectoryEntry objDEParent = new DirectoryEntry(@"IIS://localhost/LM/W3SVC/1/ROOT/");
objDEParent.Properties["Path"] = @"C:\Web";
Unhandled Exception: System.Runtime.InteropServices.COMException (0x80005000): Unknown error (0x80005000)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName)
at System.DirectoryServices.PropertyCollection.get_Item(String 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.