Visual Studio 2010 Web deployment task failed

Visual StudioVisual Studio-2010Web Deployment-Project

Visual Studio Problem Overview


I am trying to use VS2010's 1-Click Publish feature to deploy a test site from my laptop to my server. I have the firewall turned off on both machines and the MS Deployment Service is up and running on both my laptop and the server.

However, when I try and publish from VS2010 on my laptop I get the following error:

> Error 1 Web deployment task failed.(Remote agent (URL https://192.168.1.181/:8172/msdeploy.axd?site=LocationsTest) could not be contacted. Make sure the remote agent service is installed and started on the target computer.)
The requested resource does not exist, or the requested URL is incorrect.
Error details:
Remote agent (URL https://192.168.1.181/:8172/msdeploy.axd?site=LocationsTest) 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 '' but 'v1' was expected.
The remote server returned an error: (404) Not Found. 0 0 Test.Web

Any idea what I am doing wrong here?

Visual Studio Solutions


Solution 1 - Visual Studio

Restart visual studio.

I've had this one come up on a few occasions after having just successfully deployed a WebApp on a server running IIS 7.5. Obviously since a deployment/publishing was done successfully on the server just before this error came up, there was very little that could have gone wrong on the server setup/configuration (unless the previous successful deployment did something horribly wrong and removed some configuration parameters on the server).

After having rebooted the server, checked that Web Management service and Web Deployment service were running correctly, and verified from cUrl tool that a GET of the MsDeploy.axd was successful there was only one thing left to do. Restart Visual Studio. Magically post restart of VS publish started working again. All on its own. Magical stuff, this Web Deployment :)

Solution 2 - Visual Studio

Make sure you have the WMSvc Service (Web Management Service) set to 'Auto' (and started) so it's on when you restart & check out this link

Solution 3 - Visual Studio

Make sure you have set Site/Application correctly in publish profile: Publish profile dialog in Visual Studio 2010

You get the same error message if you spell site or application name wrong.

Solution 4 - Visual Studio

Although a lot of different unrelated things can contribute to getting the 404, I solved it for my by.

  1. When installing/reinstalling the WebDeploy installer, choose Custom/Change and then ensure that 'Management Service Delegation UI' is one of the installed options, it is not installed by default, but is required for WebDeploy to work (installer bug).
  2. Use the new Management Service Delegation icon in the Server node of the IIS manager to add the 'Deploy Applications with Content' role, accepting it's default settings. But you may also want to specify a "Run As" setting with a user that has rights to modify IIS settings.
  3. Restart the Web Management Service.

After this, everything works fine. Assuming the Web Management Service is setup correctly (mine is configured to accept remote connections, the firewall port was opened, and the user I'm uploading with was added to every single Site that I want to deploy to (using the IIS Manager Permissions icon in each Site node in the IIS Manager)).

Solution 5 - Visual Studio

We found the issue was because WebDeploy was installed before the Web Management Service feature was enabled on a Windows 2008 server. After Web Management Service is installed, uninstall Web Deploy fully. Then resinstall and make sure all components of the package are selected.

Following the reinstallation we were immediately able to publishing to the server from my local machine, and also from our CI.

A couple of points to note after reading the other answers:

  • If you are getting a 404 error the problem is not one of security.
  • We did not have to restart Visual Studio for this change to take effect.
  • Reinstallation will kick off the services in automatic mode, do not adust this setting.

Solution 6 - Visual Studio

I was able to fix the same issue when I changed the "Service URL" which uses "Windows Management Service" from:

https://ExampleURL:8172/msdeploy.axd?site=SiteName

to this which uses "Remote Agent Service" instead:

http://ExampleURL

It worked just fine after that.

Solution 7 - Visual Studio

I got this error because I changed my password. The deployment wizard still saved my old password, after retyped my password, everything works fine now.

Solution 8 - Visual Studio

I've installed a couple of web servers and I keep getting this issue, so I'm posting my answer here so that I find it when I Google the problem.

Basically I always install Web Deploy 3 from the Web Platform Installer. This is the first mistake. For some reason this only installs half the stuff you need. If you have installed this, uninstall it and download the Web Deploy installer. Then choose "Complete" install.

If you are following this guide

Then disregard option 1. It's a trap

Start reading again from "2. Download the Web Deploy installer ..."

Solution 9 - Visual Studio

Silly me, I didn't have .NET 4 installed on the server

Solution 10 - Visual Studio

I got 404 from a IE browser from https:// servername:8172/MsDeploy.axd

But Chrome did not make trouble.

This can be the first test to see if you can reach the Web Management service on the server at all. In other words: When chome worked (it responded with a blank page), then you have hole through to the service on the server.

Still you also need to have permission to deploy to the specific site. In IIS find the site and do that in "IIS Manager Permissions" under Management.

Solution 11 - Visual Studio

This same message would occur almost at random when publishing projects from visual studio 2010.

The fix was to delete the $projectname.Publish.xml file (in the root directory of the project) and re-create it.

Solution 12 - Visual Studio

If you are using an SSL certificate you should go into Management Service under the IIS Manager section of Server Manager and stop the service, select the correct certificate and then start the service again. This is what worked for me (I was getting Forbidden message).

Solution 13 - Visual Studio

Like a dummy, this error was throwing for me because I hadn't installed the Remote Web Agent as part of the Web Deployment Tool available here.

Solution 14 - Visual Studio

Even though all required software are installed I had similar error. I noticed that the service URL didn't prefixed with http://. Once prefixed it works well.

Solution 15 - Visual Studio

I was getting similar errors from VS 2013 and found a fix I did not see mentioned any of the other answers.

Errors:

  • The underlying connection was closed
  • Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host, from the build server (TFS 2010).

Fix:

The fix in my case was to re-enable TLS 1.0 on the target. It's a registry key but I am using the free IISCrypto applet for this.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCranialsurgeView Question on Stackoverflow
Solution 1 - Visual StudiobhavinbView Answer on Stackoverflow
Solution 2 - Visual Studiobeatn1ckView Answer on Stackoverflow
Solution 3 - Visual StudioPavel ChuchuvaView Answer on Stackoverflow
Solution 4 - Visual StudiosimboloView Answer on Stackoverflow
Solution 5 - Visual StudioNickView Answer on Stackoverflow
Solution 6 - Visual StudioWVDominickView Answer on Stackoverflow
Solution 7 - Visual StudioAdamyView Answer on Stackoverflow
Solution 8 - Visual StudioMike the TikeView Answer on Stackoverflow
Solution 9 - Visual StudioAMissicoView Answer on Stackoverflow
Solution 10 - Visual StudioRaSorView Answer on Stackoverflow
Solution 11 - Visual StudiomaxpView Answer on Stackoverflow
Solution 12 - Visual StudioMike CheelView Answer on Stackoverflow
Solution 13 - Visual StudiosewershingleView Answer on Stackoverflow
Solution 14 - Visual StudioSundarView Answer on Stackoverflow
Solution 15 - Visual StudioDLFView Answer on Stackoverflow