Winrs error:The client cannot connect to…

by Danielvg 30. November 2009 18:03

 

Having a build server, with MsBuild, that deploys daily SharePoint builds to a test server is nothing wild, the script runs a few test, creates a wsp, copies the wsp to the test server and installs the wsp in the SharePoint environment.
Somehow someway the installation script that is executed with winrs stopped working and the build server started to report errors, mind you that this had worked perfectly for a few months. Looking at the log it said:

Winrs error:The client cannot connect to the destination specified in the reques
t. Verify that the service on the destination is running and is accepting reques
ts. Consult the logs and documentation for the WS-Management service running on
the destination, most commonly IIS or WinRM. If the destination is the WinRM ser
vice, run the following command on the destination to analyze and configure the
WinRM service: "winrm quickconfig".

The command for executing winrs looked like this:

<Exec Command="C:\Windows\System32\winrs -r:$(DeploymentServerName) &quot;$(CopySharePointWspTo)\$(BuildNumber)\$(DeploymentScript)&quot; $(SolutionDeploymentUrl)" />

After spending a few hours trying to debug pretty much everything the fix was as simple as:

<Exec Command="C:\Windows\System32\winrs -r:$(DeploymentServerName):80 &quot;$(CopySharePointWspTo)\$(BuildNumber)\$(DeploymentScript)&quot; $(SolutionDeploymentUrl)" />

Notice the difference? Yeees, somehow it had stop working and now required the port to be specified. So when it doubt add “:80”, should anyone know why this happened please do share the knowledge!