Web deployment task failed. Could not connect…serv

2019-01-31 06:05发布

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?

27条回答
啃猪蹄的小仙女
2楼-- · 2019-01-31 06:33

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

查看更多
时光不老,我们不散
3楼-- · 2019-01-31 06:34

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

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-01-31 06:34

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.

查看更多
女痞
5楼-- · 2019-01-31 06:37

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

查看更多
再贱就再见
6楼-- · 2019-01-31 06:38

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

查看更多
不美不萌又怎样
7楼-- · 2019-01-31 06:39

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.

查看更多
登录 后发表回答