MsDeploy fails for webdeploy
Asked Answered
B

3

7

I am trying web-deploy.

Because I wanted to be able to reproduce this, i used a test system

Windows 2008 RC, IIs 7.5 + Deployment package I configured deployment using http://learn.iis.net/page.aspx/516/configure-the-web-deployment-handler/ Enabled tracing http://technet.microsoft.com/en-us/library/ff729439(v=ws.10).aspx

I created a new WCF Service Application, (changed nothing) compiled it and tried to deploy

I get the following response(after a few min)

------ Build started: Project: WcfService1, Configuration: Debug Any CPU ------
  WcfService1 -> C:\Development\BrandShield\Services\WcfService1\bin\WcfService1.dll
------ Publish started: Project: WcfService1, Configuration: Debug Any CPU ------
Transformed Web.config using Web.Debug.config into obj\Debug\TransformWebConfig\transformed\Web.config.
Auto ConnectionString Transformed obj\Debug\TransformWebConfig\transformed\Web.config into obj\Debug\CSAutoParameterize\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Debug\Package\PackageTmp.
Start Web Deploy Publish the Application/package to http://dev1:8172/msdeploy.axd/MSDEPLOYAGENTSERVICE ...
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3847,5): Error : Web deployment task failed.(Could not complete the request to remote agent URL 'http://dev1:8172/msdeploy.axd/MSDEPLOYAGENTSERVICE'.)
This error indicates that you cannot connect to the server. Make sure the service URL is correct, firewall and network settings on this computer and on the server computer are configured properly, and the appropriate services have been started on the server.
Error details:
Could not complete the request to remote agent URL 'http://dev1:8172/msdeploy.axd/MSDEPLOYAGENTSERVICE'.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
An existing connection was forcibly closed by the remote host
Publish failed to deploy.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

and no logs (at all) on the dev1 server side.

I have tried many variations, but this is the simplest, easiest thing to reproduce. and it is failing.

any ideas?

Bimestrial answered 5/6, 2012 at 9:20 Comment(1)
look at mperlstein.blogspot.co.il/2012/04/web-deployment-on-iis7.htmlBimestrial
B
10

I found the issue.

instead of "http://" dev1:8172/msdeploy.axd I used dev1:8172/msdeploy.axd

this is actaully the same as "https://" dev1:8172/msdeploy.axd, which for some reason is where the deployment agent listens.

From here, you will get a new error:

Could not complete the request to remote agent URL 'https://dev1:8172/msdeploy.axd?site=Default web site'. 
The underlying connection was closed: 
Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure.

This is because you don't have a certificate for SSL.

In the publish profile window, You need to check the "Allow untrusted certificate" checkbox

and the publish should succceed. good luck

Bimestrial answered 5/6, 2012 at 9:20 Comment(0)
L
0

by pass the certificate:

Step 1:

System.Net.HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertifications;

step 2:

public Boolean AcceptAllCertifications(Object sender, System.Security.Cryptography.X509Certificates.X509Certificate certification, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
    return true;
}
Lighten answered 25/3, 2017 at 5:8 Comment(0)
D
0

In my case I had this problem in an Azure DevOps build pipeline and it was a SSL/TLS version mismatch between build agent (on-prem machine) and Azure DevOps. I am not sure why it happened but I followed this guide detailing the use of SCH_USE_STRONG_CRYPTO flag in registry to force the use of "strong cryptography" (TLS 1.2, TLS 1.1, and TLS 1.0).

On the build agent machine I updated the registry with the following keys for .NET Framework 4 (x86/x64):

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319]
"SchUseStrongCrypto"=dword:00000001

What I still do not understand is why I was not using "strong cryptography" from the start and what I actually was using? (SSL v.X? Why?)

Didynamous answered 9/3, 2020 at 19:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.