Web deployment task failed. Could not connect...server did not respond
Asked Answered
A

34

91

I've been publishing my Lightswitch app using Visual Studio 2012 RC to my localhost (Win 7, SQL 2008 R2, IIS 7.5) just fine. Now I'm trying to publish to a remote server (Win 2008 R2, SQL 2008 R2, IIS 7.5) and I'm having trouble.

When I try to Publish, I receive the following error:

Web deployment task failed. (Could not connect to the remote computer ("###.###.###.###") using the specified process ("Web Deployment Agent Service") because the server did not respond. Make sure that the process ("Web Deployment Agent Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)

I've checked each of the things the "learn more" link suggests to check. I have verified that MsDepSvc and WMSVC are both running and Ports 80 and 8172 are both responding to port scans. In the Publish settings, for the Service URL, I'm using the IP address (http://###.###.###.###) of the remote machine. For the User Name, I'm using DomainName\Administrator which is what I use to log on using RDP.

I've posted on the MSDN Forums where a member suggested I roll back the Web Deployment Tool from V2.0 to V1.1. Which I've done, but it did not change anything.

Following the advice in an answer to this SO Question I've tried running msdeploy from the command line.

From the command line on the server I get:

C:\Program Files\IIS\Microsoft Web Deploy>msdeploy -verb:dump -source:dirpath=c:\temp,computername=http://SeverName:80/msdeployagentservice,username=Administrator,password=XXXX -verbose -debug Verbose: Using ID 'c12c3392-2290-44b7-9434-dbd0ff5f9385' for connections to the remote server. Verbose: Pre-authenticating to remote agent URL 'http://ServerName:80/msdeployagentservice' as 'Administrator'. MSDeploy.dirPath (name=MSDeploy.dirPath) c:\temp (name=dirPath) (keyAttribute=c:\temp) (linkName=Child1)

From the command line on the dev machine I get:

C:\Program Files\IIS\Microsoft Web Deploy V3>msdeploy -verb:dump -source:dirpath =c:\temp,computername=http://###.###.###.###:80/msdeployagentservice,username=Administrator,password=XXXX -verbose -debug Info: Using ID '7f0b7d5b-e202-424c-a7dd-246920253081' for connections to the remote server. Verbose: Pre-authenticating to remote agent URL 'http://###.###.###.###:80/msdeployagentservice' as 'Administrator'. Verbose: Pre-authenticating to remote agent URL 'http://###.###.###.###:80/msdeployagentservice' as 'Administrator'. Error Code: ERROR_COULD_NOT_CONNECT_TO_REMOTESVC More Information: Could not connect to the remote computer ("###.###.###.###") using the specified process ("Web Deployment Agent Service") because the server did not respond. Make sure that the process ("Web Deployment Agent Service") is started on the remote computer. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC. ---> Microsoft.Web.Deployment.DeploymentException: Object of type 'dirPath' and path 'c:\temp' cannot be created. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse() at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponse(HttpWebRequest request) --- End of inner exception stack trace --- --- End of Inner Exception Stack Trace --- at Microsoft.Web.Deployment.DeploymentManager.CreateObjectPrivate(DeploymentProviderContext providerContext, DeploymentBaseOptions baseOptions, DeploymentObject sourceObject, String serverVersion) at Microsoft.Web.Deployment.DeploymentManager.CreateObject(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions) at MSDeploy.MSDeploy.CreateObject(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions) at MSDeploy.MSDeploy.ExecuteWorker() at MSDeploy.MSDeploy.Execute()
at MSDeploy.MSDeploy.Main(String[] unusedArgs) Error count: 1.

Using Wireshark, I find that I am logging in okay but after a POST /MSDEPLOYAGENTSERVICE I'm getting an Error 400: Bad request that looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">\r\n
<HTML><HEAD><TITLE>Bad Request</TITLE>\r\n
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>\r\n
<BODY><h2>Bad Request - Invalid Content Length</h2>\r\n
<hr><p>HTTP Error 400. There is an invalid content length or chunk length in the request.</p>\r\n
</BODY></HTML>\r\n

The only thing I could find that mentioned this specific behavior was a Microsoft Support Article for ISA Server 2000.

What else should I be looking at?

Allantoid answered 3/8, 2012 at 13:35 Comment(6)
Any resolution to this? I'm running into the same problem.Sarita
@Sarita We ended up switching to Windows Azure as a hosting provider. The price was comparable and the deployment features are much more tightly integrated. The whole experience was much smoother. I was able to get our application deployed in 2 days which is something I couldn't accomplish in over 2 weeks of struggling with IIS deployment. I'm quite happy with the switch.Allantoid
I have answered a similar question here: #18857097Wernick
I'm having this same issue with an on prem 2012 R2 server. Literally none of the answers below or anywhere else are working. No firewall, all services started and configured for remote connection, sites named correctly, etc. I dunno what else I can do.Allianora
I just had to start the Web Deployment Agent Service. for some reason it didn't start automatically.Bureau
Maybe the problem was with the IP Address Restrictions configuration of the IIS Management Service: https://mcmap.net/q/242486/-web-deploy-results-in-error_could_not_connect_to_remotesvcExert
F
118

I had the same problem with Web Deploy 3.5 when I installed it with "Web Platform Installer 5.0"

When I tried to publish from Visual Studio I got this error:

---------------------------
Microsoft Visual Studio
---------------------------
Could not connect to the remote computer ("10.0.3.102") using the specified process 
("Web Management Service") because the server did not respond. Make sure that the process 
("Web Management Service") is started on the remote computer.  Learn more at: 
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC. 
The remote server returned an error: (403) Forbidden.
---------------------------
OK   
---------------------------

I double checked the services, both was running. I switched off the firewall also and still the same error.

How I solved this problem:

  1. open "Add or remove" programs
  2. Click on "Microsoft Web Deploy"
  3. Click on "Change" button (besides "Uninstall")
  4. Click on "Next" in

enter image description here

  1. Click on "Change" in

enter image description here

  1. Add the features marked with red X

enter image description here

  1. Finish the installation

    Result: Publish from Visual Studio is working

Forcible answered 8/10, 2014 at 10:10 Comment(9)
I was thinking all I needed to amend was the remote Agent Service, but nope. Nice one.Sayers
Lucian you are a boss!! Why is this not selected by default?Portecochere
@John'Mark'Smith It looks like this happens when Web Deploy is installed before the IIS Management Service role is installed. From iis.net: Web Deploy must be installed with the Management Service Integration component. (For this option to appear in the Web Deploy installer, the Web Management Service must be enabled first.)Miraculous
Seems it needs the Web Management Service to be installed FIRST before installing Web Deploy 3.6 (at least in my case for some reason). Typical MS instructions don't even mention this at all. I tried installing the Management Service using the Web Deploy 3.6 installer but everything messed up. I had to uninstall Web Deploy 3.6 and reinstall it, then all was well. Also, please double check that both Web Deployment Agent and Web Management services are running.Hanoi
Was hoping this would work but alas it did not. NOTHING is working.Allianora
@Forcible I have been stuck on this for hours!! THANK YOUNickey
This guy is a heroAtlantic
May the Supreme Lord Bless You. Thank You so muchHoffmann
Even GPT Does not have knowledge of this... Nice OnePenultimate
D
72

I encountered this yesterday. In my scenario it entirely boiled down to in the publish settings where it asks for Site Name: I provided MyApplication. When it really was expecting me to provide:

Default Web Site/MyApplication

I brought this up with the Microsoft Deployment team so hopefully they can add clarity that if you don't specify an existing site name that it's not the web deploy server being dead the way this error makes you think.

Dru answered 31/5, 2013 at 15:1 Comment(10)
I had the same problem. Web Deploy is such a b1tch!Peeve
Same here, I didn't actually realise it was after the name of the virtual webserver and application folder under site name, just thought it was for my reference. Doh.Tallbott
Yes, for my case it was the Site Name alright. But I don't have to add Default Web Site. Just need to make sure the Site Name exist on the server.Contractile
Chris, next time you're in Boston I owe you a beer.Trochilus
Thank you so much. Free beer for you in Denver as well.Lodestar
I live in Australia Chris, but if I'm in Boston or if you want to come over here, I'll buy you several beers.Melchor
3 years later and this is still a problem. 3 years later and you are still a hero @Chris MarisicAdaptive
Have some more points. I'd entered MyServerName/MyApplication (i.e what i'd type in to get to it). Doh!Sayers
@NathanMcKaskle did you double check the name of the application? It doesn't have to be "Default Web Site" it could be personalizedDru
Wow, I have been trying to fix this for hours. This fixed my issue. Gotta love MSMew
H
12

I have had the same problem and solved it by deleting all the web deploy folders in program files(x86)\IIS and in Program Files\IIS.

After that I reinstalled web deploy 1.1 and web deploy 3.0 without bundled SQL.

Helicon answered 27/11, 2012 at 9:51 Comment(1)
This worked for me. I think I may have had more than one version of Web Deploy installed. After deleting all the Web Deploys in the folder as described, I also installed the Web Deploy 3.0 without bundled SQL. Before all this, I had installed most of the items in the "Recommended Stuff for Hosting Dudes" item in WebPI.Clunk
C
9

Using information from several forums and answers I finally managed to install Microsoft's Web Deploy the way that I could use it for publishing from Visual Studio successfully (tested without activated firewall):

  1. Install "Management Services" for IIS using "Add Roles Features" in Server Manager
  2. Install Web Deploy (Important: "Complete" AND after "Management Services" had been installed) http://www.iis.net/downloads/microsoft/web-deploy#additionalDownloads

  3. Ensure in IIS on server level

    • Open 'Management Service'
    • Allow both Windows and IIS credentials
  4. In IIS on site level
    • Open 'IIS Manager Permission'
    • Add user which shall be used for the actual publishing, e.g. Administrator

If Firewall is active: enable "File Sharing" and "Remote Service Management"

Cislunar answered 20/7, 2016 at 14:44 Comment(2)
This worked for me, when you choose custom VM image instead google click to deploy solution for ASP.NET platform to enable web deploy from Visual Studio 2015 and above please follow this step too.Mop
This was the missing piece for me.Gownsman
C
7

To Resolve the issue i used these steps: Server: WS2012. DEV Vs2012 Project MVC4.

1) Create Empty Site on Server with Name required or when publishing use "Default Web Site" if you haven't renamed the default to something else.

I used information in this link

On the server using WPI install the following

Install Web Deploy (3.5) for Hosting Servers

Recommended Server Configuration for Web Hosting providers

I made sure other versions where NOT installed

So Verify the Site Name you are using....I use AdminUI. This is an Empty site created on the Test Server

Site Name is important.

So when using the Wizard, match the site name

Publish wizard

Make sure the relevant services ARE running on the server. And that you have sufficient privileges to write to the Site

services

Coprology answered 2/8, 2013 at 3:33 Comment(0)
A
6

I have managed to fix this on my server by restarting the Web Management Service

Affianced answered 11/3, 2014 at 7:46 Comment(2)
I've found this problem after interrupting a very long deployment several times. In this case, this solution worked for me.Lacustrine
I had this issue with an Azure Web App. Restarting it worked as well in this case.Glendon
C
4

What Chris said: "When it really was expecting me to provide "Default Web Site/MyApplication"." The actual words "Default Web Site", not the name of your server.

I had this as well and spent hours beating my head against a wall until I tried this. (Thanks Chris!)

FWIW, I was using the name of the default web site (servername) not the words "Default Web Site" which is what you apparently MUST use. Kind of lame, but at least I know now.

Costello answered 17/7, 2013 at 15:41 Comment(1)
Good call, i could have clarified that Default Web Site varies depending upon your IIS usage. The DWS name is what it always just starts with. I've tended to always host under DWS and never create multiple sites.Dru
E
3

I had the same problem. Finally solved it by changing to https in the Service URL.

Elviraelvis answered 28/11, 2012 at 8:20 Comment(0)
L
3

Its also a good idea to check if there are any IP address restrictions for the management service - these restrictions are separate from windows firewall.

windows management service

Lour answered 7/3, 2018 at 1:57 Comment(0)
I
3

Ensure that traffic to port 8172 is allowed. Adding an inbound rule on my NSG solved it.

enter image description here

Illumine answered 13/6, 2018 at 6:11 Comment(0)
W
3

This error ERROR_COULD_NOT_CONNECT_TO_REMOTESVC cost me two days to figure out that for my case, the site name didn't match. The site name on the remote IIS server was different from the site name i had set in visual Studio for the deployment. I hope it helps someone

Weep answered 25/10, 2019 at 8:56 Comment(1)
The same for me, your comment helped me to save hours. Thank you!Grijalva
C
2

Please install latest version Microsoft Web Deployment Tool. You can use below link. https://www.iis.net/downloads/microsoft/web-deploy

Chile answered 17/8, 2017 at 15:27 Comment(2)
This not provide solution to the problem specified.Recoil
Actually, this did work for me. I'm on Server 2019, running IIS. Even after installing "dotnet-hosting-7.0.8-win.exe" didn't work for me. Yet, the link from Osman, installing "WebDeploy_amd64_en-US.msi" on my Server 2019, hosting IIS, did in fact work and now I can deploy remotely from VS2022, directly across to the IIS host with no issue. Thank you.Zakaria
U
2

If you have installed web deploy just check if its related services are running

enter image description here

if one of them is stoped you will get such error

Upmost answered 18/2, 2022 at 9:12 Comment(1)
here is how to install the service: mohamedradwan.com/2015/08/07/…Summarize
K
1

I've also wasted some hours on this error (ERROR_COULD_NOT_CONNECT_TO_REMOTESVC) today, the funny part was that I was able to deploy with the gui contructed Properties/PublishProfiles/<Profile>.pubxml(via right click on project -> Publish... -> create via wizard).

In my case however, I've accidentially messed up the <DeployIisAppPath> attribute. This needs to point to the SiteName instead of ApplicationPool/SiteName. Here is the complete block from my *.csproj file:

<Project ...>
...
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DEV-Deploy|AnyCPU'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>x64</PlatformTarget>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
    <DeployIisAppPath>HERE GOES THE SITE NAME ONLY</DeployIisAppPath>
  </PropertyGroup>
...
</Project>

So if you've configured the SiteName to be Foo, the last part of that config block would be <DeployIisAppPath>Foo</DeployIisAppPath>.

Also, the whole information on the IIS Site for error codes never really helped.

Konyn answered 19/9, 2013 at 14:49 Comment(0)
P
1

Web deployment task failed. (Could not connect to the remote computer.)

In my case all, I had to restart the web deployment agent service on the remote box.

Penitentiary answered 24/4, 2015 at 15:47 Comment(0)
G
1

I had another situation where this suddenly stopped working for me.

It was because I had an IP Address Restriction specified in Management Service and my ISP assigned me a new IP. I forgot I specified that.

  1. Open up IIS Manager
  2. Click on the server name in the tree on the left
  3. In the Features View, select "Management Service"
  4. Stop the management service on the right panel
  5. Add your new IP under IP Address Restrictions and remove the old one
  6. Apply the changes and start the service again
  7. Update the troubleshooting section of your server documentation with these steps :)
Glendon answered 19/9, 2015 at 21:25 Comment(0)
V
1

Same problem on AWS EC2 instance.

  1. Navigate to EC2 instances, select corresponding instance and in Descriptions section copy Security groups name

enter image description here

  1. Navigate to Security Groups and select corresponding security group and add following Input rules if missing

enter image description here

Viticulture answered 17/9, 2017 at 15:13 Comment(0)
C
1

I tried all the other popular solutions here and none of them worked for me. :(

I had installed "Web Deploy 3.6 without bundled SQL support" first.
Then the "Recommended Server Configuration for Web Hosting Providers".
I thought, "I don't need all that SQL support".
I couldn't move past the "Validate Connection" on my Visual Studio Publish Profile without seeing the same error the Questioner documents above.

I read somewhere how uninstalling and reinstalling Web Deploy would fix it, so I opened up "Programs and Features", found "Microsoft Web Deploy 3.6", then uninstalled it.
It gave me warnings about others being connected to the system, but I was desperate.

After uninstalling, I opened up IIS, clicked on my Server's node, then under the "Management" section opened "Web Platform Installer" and installed "Web Deploy 3.6" this time (which is what I usually install instead of the one without the SQL Support).
Then I was finally able to validate the connection from my local machine via Visual Studio.

It probably has nothing to do with which version of Web Deploy I installed.
I read how this stuff is finicky about the order in which you install these tools and recommendations.
I figure it was because did something out of order (like installing the Recommended Server Configurations after the Web Deploy, instead of beforehand), but it's all good now.

Here's a link with some helpful instructions to follow when installing Web Deploy on IIS 8.0:
https://learn.microsoft.com/en-us/iis/install/installing-publishing-technologies/installing-and-configuring-web-deploy-on-iis-80-or-later

Coordinate answered 17/4, 2018 at 13:3 Comment(0)
H
1

I had similar problem "ERROR_COULD_NOT_CONNECT_TO_REMOTESVC" and I went to IIS -> Your WebSite -> Advanced Settings and found there was my username in "Physical Path Credentials". I removed it and the wed deploy started working.

Also make sure when you deploy from VS use "localhost" without port number and site name in the next field.

I put port and it also was failing with ERROR_DESTINATION_NOT_REACHABLE.

Heffernan answered 9/6, 2018 at 19:53 Comment(0)
I
1

Check for TLS mismatch. We were using SchUseStrongCrypto reg key to force TLS 1.2 on one machine and not the other. Blogged more detail here https://fuseit.zendesk.com/hc/en-us/articles/360000328595

Imparadise answered 12/7, 2018 at 3:25 Comment(0)
L
1

I was facing a similar issue in Visual Studio 2022.

Error Web deployment task failed. (Could not connect to the remote computer ("<>.scm.azurewebsites.net"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.) The requested resource does not exist, or the requested URL is incorrect. Error details: Could not connect to the remote computer ("<>.scm.azurewebsites.net"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE. The remote server returned an error: (404) Not Found. Intranet.Hub.Admin

The real issue was that I started the publishing right after the web application is been created. So it would be a good idea to wait for a few minutes before you download the publishing profile from the Azure web application, and upload it to the Visual Studio.

If you are still facing the same issue change the value of Application settings WEBSITE_WEBDEPLOY_USE_SCM to false, download the publishing profile, upload it in the Visual Studio, and then publish.

You can also deploy the Web Deploy as a site extension in your Azure Web App. I wasn't able to do this, as I was using a Linux Azure Web application, the Site Extension option was greyed out. That feature is yet to be provided for Linux.

enter image description here

Lobate answered 7/9, 2021 at 15:14 Comment(0)
R
0

I also got this working by uninstalling all Web Deploys, and then only install Web Deploy 2.0.

Rhomboid answered 15/5, 2013 at 12:29 Comment(0)
G
0

Also, ensure the Remote Procedure Call (RPC) Locator service is started.

Grassofparnassus answered 22/7, 2013 at 18:54 Comment(0)
L
0

I have solved this by putting the word "Default Web Site" in the site name textbox when publishing from the wizard in Visual Studio 2013

Lanam answered 19/12, 2014 at 3:8 Comment(0)
C
0

Just remove http:// from http://SeverName:80/msdeployagentservice. Also try just using ServerName. I was having this problem and was solved just removing http://

Cornemuse answered 8/5, 2015 at 18:28 Comment(0)
I
0

I set my Username and Password, that used in the Config Web Deploy of the iis, in the Connection Window of visual studio and it works fine for me...

Isador answered 30/6, 2015 at 11:48 Comment(0)
I
0

Apparently what works for me is simply restarting my visual studio/restarting my computer and do a re-deployment by republishing my web app.

Incise answered 6/12, 2015 at 5:4 Comment(0)
P
0

Also make sure that a website in IIS exists with the name that you have provided under 'Site Name' field.

Preoccupancy answered 18/1, 2020 at 8:46 Comment(0)
G
0

In my case Web Deployment Tool is not installed. After installing it in Web Platform Installer worked for me.

Godin answered 30/1, 2020 at 10:46 Comment(0)
C
0

I had the same issue while trying to publish a website to azure app service.
In my case, I have created a virtual path for a new website, for some reason that is not related to the subject I deleted that virtual path from the app service.
that I have created it again but forgot the press save in the Azure portal.
the consequence was that error,
of course, this was solved by creating this virtual path again without forgetting to save.

To make it more clear the last virtual path was not exist:
enter image description here

Clarkia answered 24/4, 2020 at 14:41 Comment(0)
U
0

I've tried most of the proposed answers but without solving the problem. However here's my solution :

1-close FTP connections if there are any

2-use a faster connection, using a slow wifi causes this issue

Upmost answered 16/12, 2020 at 12:48 Comment(0)
H
0

I ran into this as well when trying to set up a brand new IIS publish profile. I was getting this error when trying to validate the connection on the new profile setup screen. The solution was to not enter a username or password and click Save to save the profile. Then, after the profile was created, I could edit the profile and enter the username and password and the validation was successful at that point.

Hobnob answered 10/11, 2022 at 23:25 Comment(0)
C
0

For me it worked after restarting Visual Studio.

Celery answered 5/3 at 11:45 Comment(0)
S
-1

I had the same issue while I was publishing a selective group of files. I just selected all files to be published and then published successfully.

Sallysallyann answered 1/3, 2018 at 5:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.