Monday, June 25, 2018

TFS Build error - System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Web.Administration.Interop.IAppHostWritableAdminManager'.

After replacing one of our build servers, we got the following error when trying to execute a custom XAML build Workflow activity:

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Web.Administration.Interop.IAppHostWritableAdminManager'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{FA7660F6-7B3F-4237-A8BF-ED0AD0DCBBD9}' failed due to the following error: Interface not registered (Exception from HRESULT: 0x80040155).

at Microsoft.Web.Administration.ConfigurationManager.CreateAdminManager[TClass,TInterface](WebConfigurationMap webConfigMap, Boolean isAdminConfig)

at Microsoft.Web.Administration.ConfigurationManager.CreateConfiguration(WebConfigurationMap configMap, String configPathToEdit, Boolean isAdminConfig)

at Microsoft.Web.Administration.ConfigurationManager.GetConfiguration(String rawConfigurationPath, String cacheKey, Boolean isAdminConfig)

at Microsoft.Web.Administration.ServerManager.get_ApplicationPoolsSection()

at Microsoft.Web.Administration.ServerManager.get_ApplicationPools()

at Microsoft.Web.Administration.ServerManagerExtensions.TryGetAppPool(ServerManager serverManager, String appPoolName, ApplicationPool& result)

at Customer.TeamFoundation.Build.Workflow.Activities.ControlAppPool.InnerExecute(CodeActivityContext context)

This activity tries to talk to IIS on our test environment to stop and restart the application pool after installation. The reason why it failed is because this activity requires IIS installed on the build server to allow remote administration.

After installing it, our XAML builds turned all green again…

No comments: