Visual Studio 2010 Web deployment task failed

79,363

Solution 1

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 2

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 3

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

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

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.
Share:
79,363
Cranialsurge
Author by

Cranialsurge

Updated on September 18, 2020

Comments

  • Cranialsurge
    Cranialsurge over 3 years

    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?

  • ROOH
    ROOH almost 14 years
    Note - Service name: 'MsDepSvc' - Display name" 'Web Deployment Agent Service'
  • Khalid Abuhakmeh
    Khalid Abuhakmeh over 12 years
    EVERYONE SHOULD TRY THIS FIRST BEFORE JUMPING THROUGH SERVER CONFIGURATION HOOPS!
  • Chase Florell
    Chase Florell over 12 years
    Restart Visual Studio... simple!
  • Dan Doyon
    Dan Doyon over 12 years
    This was my needful, we had a system that was setup differently (than it should be) and I was going frikkin bonkers.
  • Dan Doyon
    Dan Doyon over 12 years
    Look at solution below, just as important.
  • zer0w1dthspace
    zer0w1dthspace over 12 years
    rebooted the server not worked. deleted publish.xml not worked. restart the vs started. hell yeah thanks :)
  • aleafonso
    aleafonso about 12 years
    Hahaha this was exactly what happened to me. Amazing that we faced this situation almost at the same time and nobody else had commented this issue
  • Brad Crandell
    Brad Crandell almost 12 years
    Pffft. "You get the same error message if you spell site or application name wrong." I'm such an idiot.
  • randomsequence
    randomsequence almost 12 years
    To add to this, I had a similar issue but it worked for me after restarting the various services plus IIS on the server. Recommend installing the Management Service before Web Deploy in future!
  • Mohsen Afshin
    Mohsen Afshin over 11 years
    The same problem here, WebDeploy must be installed after Web Management Service, now the error changed to unauthorized user which can be fixed, thanks Nick
  • Tomas
    Tomas over 11 years
    +1 for Management Service Delegation UI. M$ lamers leaving common features disabled by default...
  • Tomasz Maj
    Tomasz Maj over 11 years
    too simple to be true, but it is :P
  • Mason G. Zhwiti
    Mason G. Zhwiti about 11 years
    Yeah, if you wrongly thought like I did that you could setup a fresh server with web deploy -- WRONG. You need to at least rename "Default Web Site" to the actual website you would like to publish. (Or create a new website matching that name.) I was thinking when I published all of this would be done for me, but instead the publish just failed...
  • John
    John almost 11 years
    This is why computers suck. FYI - I didn't get a 404 error, and if I navigate to the Msdeploy.axd URL directly, it doesn't respond (leading me to think this was a server problem), but sure enough: restarted VS, and it deploys successfully.
  • The Muffin Man
    The Muffin Man over 10 years
    Well to be fair the Web Platform installer has the downloads for the missing pieces. You can install web deploy 3.5 on its own, but there is also Web Deploy 3.5 for Hosting Servers and Web Deploy 3.5 without bundled sql suppot (latest)
  • SliverNinja - MSFT
    SliverNinja - MSFT about 10 years
    Confirming...this worked great for me as well in Visual Studio 2013. I ended up reinstalling Web Deploy and it took care of this issue. I can now use the first format and the second format equally without issue.
  • Gašper Sladič
    Gašper Sladič about 10 years
    Worked for me too. Tnx!
  • Mosè Bottacini
    Mosè Bottacini over 8 years
    Worked for me also, i had a process on the server which have probably saturated the number of connection, rebooting it freed everything and the deploy worked as usual, THANKS!