applicationHost.config corruption

Michael Knoll's Avatar

Michael Knoll

18 Apr, 2017 08:48 PM

We encountered an issue when deploying multiple website to a production server. The deployment succeeded in test and stage, but when promoting to production, we receive the error:

Attempt 4 of 5 failed: Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Line number: 1
Error: Configuration file is not well-formed XML
Waiting for 2 seconds before retrying...
get-webitemstate : Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Line number: 1
Error: Configuration file is not well-formed XML
At C:\xxxxx\Octopus.Features.IISWebSite_BeforePostDeploy.ps1:165 char:3
+ $state = Get-WebAppPoolState $applicationPoolName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WebItemState], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.GetItemStateCommand

This error has occurred on multiple web sites on the server, in different parts of the deployment of the site. It has failed setting windows authentication, and updating bindings. Once the error has occurred, the applicationHost.config file has contained a powershell script, and what appears to be the binary of a DLL.
I have compared the applicationHost.config file from our stage and prod server, and found no significant difference. They both appear to be valid XML, and the only differences are expected because of the environment/machine difference.

Are there any known causes of this issue? The deployment steps are Octopus Deploy build-in steps, any recommendations for debugging them?

Just a note for anyone that has had this happen to them, the config file can be recovered by copying it from c:\inetpub\history.


  1. Support Staff 1 Posted by Nick Josevski on 19 Apr, 2017 12:39 AM

    Nick Josevski's Avatar

    Hello Mike,

    Thanks for getting in touch, this is a strange one. We've seen it at least once before but have not been able to reproduce it. Our suspicion is multiple threads causing the issue, in version 3.11.18 of Octopus we put in some safe guards to make IIS deployments more reliable. If you can you can try and update to a version after that to see if it solves the problem:

    Could we get some more details from you to help us work out what's going on. What version of IIS and on which version of Windows is it running on, and which version of Octopus are you currently running.


  2. 2 Posted by Michael Knoll on 19 Apr, 2017 05:54 PM

    Michael Knoll's Avatar

    We are running Octopus version 3.7.14. Our servers are Microsoft Windows Server 2012 R2 Standard, running IISversion 8.5.9600.16384.


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

25 Apr, 2017 04:28 PM
25 Apr, 2017 04:08 PM
25 Apr, 2017 04:04 PM
25 Apr, 2017 03:43 PM
25 Apr, 2017 03:39 PM


25 Apr, 2017 03:31 PM
25 Apr, 2017 03:28 PM
25 Apr, 2017 03:11 PM
25 Apr, 2017 02:54 PM
25 Apr, 2017 02:27 PM
25 Apr, 2017 01:17 PM