msdeploy fails with ERROR_CONNECTION_TERMINATED on TeamCity

50 Views Asked by At

When i run msdeploy from teamcity i get ERROR_CONNECTION_TERMINATED. But if i run it from cmd on the same server (where teamcity is running) it goes through. ERROR_CONNECTION_TERMINATED occours only if site is up to date, if it has to do alot of stuff then there is no error.

I'm not running fiddler that could be causing this.

Here is command: msdeploy -verb:sync -source:contentPath="%teamcity.build.checkoutDir%\publish\web" -dest:contentPath="%DeployPath%\web",ComputerName="%MSDeploy.ComputerName%",Username="%MSDeploy.Username%",Password="%MSDeploy.Password%",AuthType="Basic" -useCheckSum -skip:Directory="\\web\\uploads$" -skip:File="\\app_offline.htm$" -allowUntrusted 

Output:

[11:32:15][Step 9/9] PowerShell Executable: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

[11:32:15][Step 9/9] Working directory: C:\TeamCity\buildAgent\work\81d93b891723185

[11:32:15][Step 9/9] Command: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

[11:32:15][Step 9/9] PowerShell arguments: -NonInteractive, -ExecutionPolicy, ByPass, -File, C:\TeamCity\buildAgent\temp\buildTmp\powershell4517896340075893898.ps1

[11:32:16][Step 9/9] Info: Using ID 'a6102aa0-ae6b-43b5-9f15-5a6c0977232f' for connections to the remote server.

[11:32:17][Step 9/9] Info: Object filePath (C:\inetpub\dev.proplatform\web\app_offline.htm) skipped due to skip directive 'CommandLineSkipDirective 2'.

[11:32:27][Step 9/9] Info: Object filePath (C:\inetpub\dev.proplatform\web\ePeroWs\app_offline.htm) skipped due to skip directive 'CommandLineSkipDirective 2'.

[11:32:27][Step 9/9] Info: Object filePath (C:\inetpub\dev.proplatform\web\ipsWebApi\app_offline.htm) skipped due to skip directive 'CommandLineSkipDirective 2'.

[11:32:37][Step 9/9] Info: Object dirPath (C:\inetpub\dev.proplatform\web\uploads) skipped due to skip directive 'CommandLineSkipDirective 1'.

[11:32:37][Step 9/9] Info: Using ID '98d4de3d-2ed9-4a43-b156-ebf69bac99dc' for connections to the remote server.

[11:33:13][Step 9/9] Error Code: ERROR_CONNECTION_TERMINATED

[11:33:13][Step 9/9] More Information: Web Deploy experienced a connection problem with the server and had to terminate the connection. Contact your server administrator if the problem persists. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CONNECTION_TERMINATED.

[11:33:13][Step 9/9] Error: Unexpected end of file has occurred. The following elements are not closed: results. Line 1, position 550.

[11:33:13][Step 9/9] Error count: 1.

I tried running command in cmd and powershell on teamcity. I got error on TC, but if i run command directlly in cmd or powershell on the same server i got no error.

1

There are 1 best solutions below

0
Marko Dežan On

I found what the problem was. It was Windows real time protection which was cousing this problem. So i added process msdeploy.exe as an exception and now it works fine. I hope this helps somebody in the future. I spent days trying to figure it out what the problem was.