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?
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:
I double checked the services, both was running. I switched off the firewall also and still the same error.
How I solved this problem:
Finish the installation
Result: Publish from Visual Studio is working
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):
Install Web Deploy (Important: "Complete" AND after "Management Services" had been installed) http://www.iis.net/downloads/microsoft/web-deploy#additionalDownloads
Ensure in IIS on server level
If Firewall is active: enable "File Sharing" and "Remote Service Management"
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...
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 contructedProperties/PublishProfiles/<Profile>.pubxml
(viaright click on project -> Publish... -> create via wizard
).In my case however, I've accidentially messed up the
<DeployIisAppPath>
attribute. This needs to point to theSiteName
instead ofApplicationPool/SiteName
. Here is the complete block from my*.csproj
file: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.
I have managed to fix this on my server by restarting the Web Management Service
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://docs.microsoft.com/en-us/iis/install/installing-publishing-technologies/installing-and-configuring-web-deploy-on-iis-80-or-later