7
votes

I'm trying to deploy my ASP.NET MVC 3 web application using VS2010 Publish feature. I'm using Web Deploy as Publish method, but I'm getting this error:

Error 1 Web deployment task failed.(Remote agent (URL http://192.168.1.11/MSDEPLOYAGENTSERVICE) could not be contacted. Make sure the remote agent service is installed and started on the target computer.) Make sure the site name, user name, and password are correct. If the issue is not resolved, please contact your local or server administrator. Error details: Remote agent (URL http://192.168.1.11/MSDEPLOYAGENTSERVICE) could not be contacted. Make sure the remote agent service is installed and started on the target computer. An unsupported response was received. The response header 'MSDeploy.Response' was 'V1' but 'v1' was expected. The remote server returned an error: (401) Unauthorized.

How can I bypass this and to put it work? My server is Windows 2008 R2.

3

3 Answers

5
votes

Take a look at this answer I provided for someone encountering a different issue, WebDeploy has a few gotcha's:

msdeploy (Web Deploy) failing with 401 auth issues

Also make sure you upgrade to WebDeploy 2.0 if you have control over both your development machine and the server.

And finally make sure you configure the server properly, trust me taking the time over this step can save hair:

Configure Web Deploy

1
votes

For those still looking, I had to make sure to:

  • Specify port 8172, use the default service name (msdeploy.axd), use https and check the box to allow untrusted certificates in the publish service url from Visual Studio: https://serveraddress:8172/msdeploy.axd

Also, I found this IIS article to be extremely helpful for setting up the service.

1
votes

I pulled my hair out for 4 hours over this. Here's what I used for config settings. In IIS (7.5 on server 2008 R2)

I gave publishing permissions to an IIS account I had set up (although I used the Server Admin account also, to rule out permission issues, in the end, both worked.)

I left everything else as is. The sever I deployed to was a VPS, so the computer name had nothing to do with my application, or domain, so I left the Specify the URL for the publishing connection as it was. I left the location to save the publish settings file as it was.

In Visual Studio:

  • Publish Method: Web Deploy
  • Service URL: https://myservice.com (no port or msdeploy here, just the url over https)
  • site application: mysitename/myapplicationname (for me they were both the same name)
  • Mark as IIS application : checked
  • Leave Extra files: checked
  • Allow Untrusted Cert: checked

For the username - I did not need to use the fully resolved name, so user, as opposed to servername\user - worked fine.

This failed with a 404 error - and if I tried sending it over http instead of https(Service URL) it failed with a socket error (10054).

I verified that all the required services were running and I restarted them all. I also restarted IIS (which for my situation is painful). Still nada.

Then I decided to re-install web deploy on the server(3.0 RC). I made sure to use the custom install option, when I did that I made sure that all components and handlers were installed (they aren't by default). Once I did this everything started to work fine.

I'm not sure if I had a bad install the first time around, but it's working great now.