Search This Blog

Sunday, March 18, 2012

IIS 7 Web Farm Framework - Error When Syncing a New Server

I was setting up a new IIS 7 web farm to replace five IIS 6 web servers. We started off by configuring a control server running Windows Server 2008 R2 x32 and IIS 7.5. This control server was also set to be the Primary server role in syncing the other web servers.

Each web server would be a fresh install of Windows Web Server 2008 R2 x64 and IIS 7.5. We added each server and the platform was provisioned. Next step was to provision the applications and this is where a very unhelpful error kept occuring on each server.

"Failed to run operation 'RunRemote'.  Failed to run method 'Microsoft.Web.Farm.SyncApplicationsRemoteMethod' on server 'server name'.  Exception in response stream.  Invalid index. (Exception from HRESULT: 0x80070585).  Exception in response stream.  Invalid index. (Exception from HRESULT: 0x80070585)."

The stack trace that was logged in the WebFarmService.log file (location: C:\Program Files\IIS\Microsoft Web Farm Framework) was not any more helpful.

"at Microsoft.Web.Deployment.IAppHostElement.GetPropertyByName(String bstrSubName)
   at Microsoft.Web.Deployment.CrossPlatformRuleHandler.UpdateObjectEntryIfNeccessary(IAppHostElement sectionElement, SectionEntries entries)
   at Microsoft.Web.Deployment.CrossPlatformRuleHandler.UpdateSectionEntriesIfNeccessary(IAppHostConfigLocation location, LocationSectionEntries locSecEntries)
   at Microsoft.Web.Deployment.CrossPlatformRuleHandler.UpdateNativeModulesIfNeccessary(AdminManagerWrapper wrapper)
   at Microsoft.Web.Deployment.CrossPlatformRuleHandler.PostSync(DeploymentSyncContext syncContext)
   at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
   at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable)
   at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
   at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions)
   at Microsoft.Web.Farm.SyncApplicationsRemoteMethod.RunRemote(ServerRemoteMethodContext methodContext, Object[] parameters)
   at Microsoft.Web.Farm.WebFarmAgentService.HandleRunMethod(HttpListenerContext context)
   --- End of inner exception stack trace ---
   at Microsoft.Web.Farm.RunRemoteAsyncResult.ResponseCompleteCallback(IAsyncResult result)
   --- End of inner exception stack trace ---
   at Microsoft.Web.Farm.ProvisionApplicationsOperationProvider.EndRunOperation(IAsyncResult result)
   at Microsoft.Web.Farm.ServerOperationContext.EndRunOperationProvider(IAsyncResult result)
   at Microsoft.Web.Farm.RunOperationContext.FinalOperationCompleteCallback(IAsyncResult result)"

 

It turns out that for some reason the Web Farm Framwork's provisioning tool does not work well with the IIS 7.5 "Default Web Site" setup. The fix took a while to figure out but is pretty simple.

• Delete the "Default Web Site" site from the destination IIS server
• Run msdeploy.exe on the destination server to sync the source server's "Default Web Site"


MSDeploy.exe can be found at "C:\program files\IIS\Microsoft Web Deploy V2" and the syntax for running the sync is

msdeploy -verb:sync -source:apphostconfig="Default Web Site",computername=SourceServerName -dest:apphostconfig="Default Web Site"

This worked for me and I hope it saves you some time as well.