Hi,
Using Visual Studio 2005, C#, trying to create Virtual Directory on Windows Vista Enterprise.
The following function is called from the Installer and should create a virtual directory on the user's local machine.
All the code works perfectly on Windows XP Pro.
My C# Code:
public void CreateVirtualDirectory(string physicalPath, string VDName)
{
//Create a virtual directory
const int MD_AUTH_NT = 0x00000004; //Windows authentication schemes available.
const int MD_AUTH_ANONYMOUS = 0x00000001; //Anonymous authentication available.
System.EnterpriseServices.Internal.IISVirtualRoot vr = new System.EnterpriseServices.Internal.IISVirtualRoot();
string sError = "";
vr.Create("IIS://localhost/W3SVC/1/Root", physicalPath, VDName, out sError);
if (sError.Trim().Length > 0)
{
throw new Exception("Error when creating Virtual Directory:" + Environment.NewLine + sError);
}
DirectoryEntry deVDir = new DirectoryEntry("IIS://localhost/W3SVC/1/Root/" + VDName);
if (deVDir != null)
{
deVDir.Properties["AuthFlags"].Value = MD_AUTH_NT; //MD_AUTH_ANONYMOUS |
deVDir.CommitChanges();
}
else
{
throw new Exception("Error when creating Virtual Directory:" + Environment.NewLine + "Could not find VD " + VDName);
}
}
The above code throws the error:
(caused by line: vr.Create("IIS://localhost/W3SVC/1/Root", physicalPath, VDName, out sError); )
Log Name: Application
Source: MsiInstaller
Date: 2007/07/30 03:33:36 PM
Event ID: 11001
Task Category: None
Level: Error
Keywords: Classic
User: SOFTCRAFT\moutono
Computer: VISTAPC.softcraft.co.za
Description:
The description for Event ID 11001 from source MsiInstaller cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
Product: Rivers -- Error 1001. Error 1001: Error when creating Virtual Directory:
System.Runtime.InteropServices.COMException (0x80005000): Unknown error (0x80005000)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Add(String name, String schemaClassName)
at System.EnterpriseServices.Internal.IISVirtualRoot.Create(String RootWeb, String inPhysicalDirectory, String VirtualDirectory, String& Error)
(NULL)
(NULL)
(NULL)
(NULL)
the message resource is present but the message is not found in the string/message table
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="MsiInstaller" />
<EventID Qualifiers="0">11001</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2007-07-30T13:33:36.000Z" />
<EventRecordID>1479</EventRecordID>
<Channel>Application</Channel>
<Computer>VISTAPC.softcraft.co.za</Computer>
<Security UserID="S-1-5-21-4206377478-2519145661-2763947379-1251" />
</System>
<EventData>
<Data>Product: Rivers -- Error 1001. Error 1001: Error when creating Virtual Directory:
System.Runtime.InteropServices.COMException (0x80005000): Unknown error (0x80005000)
at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_IsContainer()
at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
at System.DirectoryServices.DirectoryEntries.Add(String name, String schemaClassName)
at System.EnterpriseServices.Internal.IISVirtualRoot.Create(String RootWeb, String inPhysicalDirectory, String VirtualDirectory, String& Error)</Data>
<Data>(NULL)</Data>
<Data>(NULL)</Data>
<Data>(NULL)</Data>
<Data>(NULL)</Data>
<Data>
</Data>
<Data>
</Data>
<Binary>7B33324344464143312D303637302D343939452D394343322D3837463635444435353339367D</Binary>
</EventData>
</Event>
Please help!