I was recently working with a client to deploy an EPiServer site and we came across a rather strange problem. The EPiServer Manager installed fine, but when I tried to set up a web site (with a database or not it doesn't matter) we were getting the following error reported:
System.InvalidOperationException: The installation failed, and the rollback has been performed. ---> System.IO.DirectoryNotFoundException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)
at System.DirectoryServices.Interop.UnsafeNativeMethods.IAds.PutEx(Int32 lnControlCode, String bstrName, Object vProp)
at System.DirectoryServices.PropertyValueCollection.OnClearComplete()
at System.Collections.CollectionBase.Clear()
at EPiServer.Install.IIS6.DirectoryEntryExtension.SetValue(DirectoryEntry entry, String propertyName, String value)
at EPiServer.Install.IIS6.DirectoryEntryExtension.CreateSite(String siteName)
at EPiServer.Install.IIS6.Installers.NewWebAppInstaller.Install(IDictionary stateSaver)
at System.Configuration.Install.Installer.Install(IDictionary stateSaver)
at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
--- End of inner exception stack trace ---
at System.Configuration.Install.TransactedInstaller.Install(IDictionary savedState)
at EPiServer.Install.InstallationManager.DoInstall()Error - System.Management.Automation.CmdletInvocationException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003) ---> System.IO.DirectoryNotFoundException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)
at EPiServer.Install.InstallationManager.DoInstall()
at EPiServer.Install.InstallationManager.CommitBulkInstall()
at EPiServer.Install.Common.Cmdlets.CommitBulkInstallCmdlet.ProcessRecord()
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
--- End of inner exception stack trace ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input, Hashtable errorResults, Boolean enumerate)
at System.Management.Automation.Parser.PipelineNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList)
at System.Management.Automation.Parser.StatementListNode.Execute(Array input, Pipe outputPipe, ArrayList& resultList)
The last line that had worked before the error was thrown was 'Copied connectionStrings.config' and after some digging around it became apparent that the error was being thrown after the EPiServer Manager had finished copying files to the web site folder and when it was trying to create the actual web site in IIS. It was an extremely frustrating problem to track down and we tried security permissions and all sorts with no luck. There is a fair bit on the web about this error (default site missing in IIS and similar things like that) but nothing was helping.
I was pretty sure it was not EPiServer itself at fault so I dug in the EPiServer and System.DirectoryServices assemblies with Reflector and figured out what was going on, then built a small test app in .Net. This also failed with exactly the same error... when .Net tried to access the IIS Metabase it was failing.
Turns out that System.DirectoryServices uses COM Interop to clear and set values within the IIS Metabase. This is what was breaking. There is a way of manipulating them using AD-style classes and that seemed to work fine, so that meant it must be something up with the way .Net was talking to IIS via COM.
The client helped out here because one of their technical guys on the server team had the brainwave of reinstalling Component Services. Hey presto, it worked - thanks Jeremy :) So if you have a similar problem, I suggest you try reinstalling COM and IIS first before getting serious with permissions and things.