MsDeploy fails for webdeploy - visual-studio-2010

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?

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

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;
}

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?)

Related

Allow HTTP download in Android Studio

I am getting the following error in Android Studio:
> Could not download builder-4.1.2.jar (com.android.tools.build:builder:4.1.2)
> Could not get resource 'http://10.252.250.53:8081/lm/content/groups/public/com/android/tools/build/builder/4.1.2/builder-4.1.2.jar'.
> Could not GET 'http://10.252.250.53:8081/lm/content/groups/public/com/android/tools/build/builder/4.1.2/builder-4.1.2.jar'.
> Connect to 10.252.250.53:8081 [/10.252.250.53] failed: Connection timed out: connect
I am able to download the file from that link in a browser. So I believe the issue is that Android Studio is not allowing HTTP download.
Please guide.
The file you download is quite outdated; this is version 7.0.2 meanwhile.
Either add a self-signed SSL certificate to 10.252.250.53:8081 + local machine and define a proxy:
systemProp.https.proxyHost=10.252.250.53
systemProp.https.proxyPort=8081
Or downgrade back to Gradle < 7.0 ...if you really want to use HTTP (which is merely dead already).

How to bypass SSL verification while using Sonarqube

I've a sonarqube MS BUILD scanner that is not able to connect to a sonarqube server:
C:\ws\develop>SonarQube.Scanner.MSBuild.exe begin /k:aaaa /n:bbb /v:4.0.0.13063 /d:sonar.host.url=https://sonarqube.aaa.bbb /d:sonar.login=****** /d:sonar.cs.nunit.reportsPaths=TestResult.xml /d:sonar.cs.dotcover.reportsPaths=dotcover.html
WARNING: ------------------------------------------------------------------------
This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.
------------------------------------------------------------------------
SonarScanner for MSBuild 4.4.2
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\Tools\SonarQubeScanner\SonarQube.Analysis.xml
Loading analysis properties from C:\Tools\SonarQubeScanner\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
14:40:23.762 Updating build integration targets...
14:40:23.774 Fetching analysis configuration settings...
14:40:23.855 Failed to request and parse 'https://sonarqube.aaa.bbb/api/server/version': The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
14:40:23.856 A server certificate could not be validated. Possible cause: you are using a self-signed SSL certificate but the certificate has not been installed on the client machine. Please make sure that you can access https://sonarqube.aaa.bbb without encountering certificate errors.
14:40:23.857 Pre-processing failed. Exit code: 1
script returned exit code 1
Is there a way to disable this SSL check? The certificate will not be valid(it's valid on our domain, but this agent is not in the domain due to the IT policy)

SonarQube build step fails with "Self-Signed Certificate in Certificate Chain" in Azure DevOps

I am currently setting up a build pipeline in Azure DevOps with a self-hosted agent. Everything is working great so far except the SonarQube build steps.
When executing the Prepare SonarQube on my self-hosted agent it fails with the following error:
2018-11-19T14:14:19.1070144Z ##[debug]organization=null
2018-11-19T14:14:19.1087901Z ##[debug]scannerMode=MSBuild
2018-11-19T14:14:19.1093031Z ##[debug]projectKey=online:kiamservices:main
2018-11-19T14:14:19.1095851Z ##[debug]projectName=Online – KIAM Services
2018-11-19T14:14:19.1098962Z ##[debug]projectVersion=1.0
2018-11-19T14:14:19.1104908Z ##[debug][SQ] API GET: '/api/server/version' with query "undefined"
2018-11-19T14:14:19.2819233Z ##[debug][SQ] API GET '/api/server/version' failed, error was: {"code":"SELF_SIGNED_CERT_IN_CHAIN"}
2018-11-19T14:14:19.2832616Z ##[debug]task result: Failed
2018-11-19T14:14:19.2928009Z ##[error][SQ] API GET '/api/server/version' failed, error was: {"code":"SELF_SIGNED_CERT_IN_CHAIN"}
2018-11-19T14:14:19.2943259Z ##[debug]Processed: ##vso[task.issue type=error;][SQ] API GET '/api/server/version' failed, error was: {"code":"SELF_SIGNED_CERT_IN_CHAIN"}
2018-11-19T14:14:19.2946004Z ##[debug]Processed: ##vso[task.complete result=Failed;][SQ] API GET '/api/server/version' failed, error was: {"code":"SELF_SIGNED_CERT_IN_CHAIN"}
2018-11-19T14:14:19.3015449Z ##[section]Finishing: Prepare SonarQube
If I run the same setup on a microsoft hosted agent it runs just fine.
It is correct that my organization uses it's own Certificate Authority but the certificates are present on the self hosted agent as far as I know.
Is there a way to tell SonarQube to just ignore certificate errors?
I have looked high and low and have sadly not found any information on this error that was even remotely helpful.
Thank you in advance!
Sonar uses the Java Keystore for its certificate checks. It doesn't look at windows' keystore at all. You'll likely be able to solve this by importing the correct certificates in the JVM's keystore using the keytool utility.
See also:
https://sylvainleroy.com/2018/07/30/sonarqube-scanner-and-invalid-ssl-certificates/

Octopus Nuget Push error: IOException: Unable to write data to the transport connection:

I am using Bamboo as build server and Octopus deploy for Deployment. I am using their command line tool, Octo.exe to create and push nuget packages to the server.
It was working fine. But we started getting errors which were intermittent at first and then became very common. Now it fails almost everytime but succeeds once in a while. I have installed the Server and tentacle in the same machine.
This is the error I am getting
Handshaking with Octopus server: http://Server/
17-May-2016 19:51:11 Handshake successful. Octopus version: 3.3.12; API version: 3.0.0
17-May-2016 19:51:11 Authenticated as: ajaybhasy <>
17-May-2016 19:51:11 Pushing package: C:\build\WOR-WA-JOB1\client\dist\WorldSmartAngular.1.0.337.nupkg...
17-May-2016 19:53:39 System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
17-May-2016 19:53:39 at System.Net.Sockets.Socket.MultipleSend(BufferOffsetSize[] buffers, SocketFlags socketFlags)
17-May-2016 19:53:39 at System.Net.Sockets.NetworkStream.MultipleWrite(BufferOffsetSize[] buffers)
17-May-2016 19:53:39 --- End of inner exception stack trace ---
According to the posts in their support I tried changing the Tentacle to polling mode, but that too didnt work for me.

Visual Studio Team Services on-premises build server

Following these instructions (Deploy an agent on Windows), I have configured an VSTS build agent to run as a Windows service. The host server is configured to access the Internet through a corporate proxy server. I am able to browse to the target VSTS site through Internet Explorer from the server.
When I view "Agents for pool Default" I see my newly configured agent, but its status is "offline" and it has a red block rather than green. If I restart the agent service then I get the following error in the event log:
The vsoAgent process failed to start successfully. It exited with code
3. Check the latest Agent log files in C:\VSTSBuild\agent_diag for more information. Waiting for 5 seconds before retrying.
However, on checking the _diag log files, there are no errors:
14:17:25.160120 Sending trace output to log files:
C:\VSTSBuild\agent_diag 14:17:25.203125 VsoAgent.exe was run with the
following command line: "C:\VSTSBuild\agent\agent\vsoagent.exe"
/runningAsService 14:17:25.345132 SettingsFileHelper.Load -
settings[AutoUpdate]=True 14:17:25.345132 SettingsFileHelper.Load -
settings[RootFolder]=C:\VSTSBuild\agent 14:17:25.345132
SettingsFileHelper.Load -
settings[WorkFolder]=C:\VSTSBuild\agent_work 14:17:25.346130
SettingsFileHelper.Load -
settings[ServerUrl]=https://XXXXappdevteam.visualstudio.com
14:17:25.346130 SettingsFileHelper.Load -
settings[AgentName]=Agent-XXXX-NCC-BT001U 14:17:25.346130
SettingsFileHelper.Load - settings[PoolId]=1 14:17:25.346130
SettingsFileHelper.Load - settings[PoolName]=default 14:17:25.346130
SettingsFileHelper.Load - settings[AgentId]=5 14:17:25.346130
SettingsFileHelper.Load - settings[RunAsWindowsService]=True
14:17:25.346130 SettingsFileHelper.Load -
settings[WindowsServiceName]=vsoagent.XXXXappdevteam.Agent-XXXX-NCC-BT001U
14:17:25.346130 SettingsFileHelper.Load -
settings[WindowsServiceDisplayName]=VSO Agent
(XXXXappdevteam.Agent-XXXX-NCC-BT001U) 14:17:25.381133
BaseLogger.LogStatus(scope.JobId =
00000000-0000-0000-0000-000000000000, scope.TimelineRecordId =
00000000-0000-0000-0000-000000000000, record.Name = Agent)
14:17:25.424136 BaseLogger.LogConsoleMessage(scope.JobId =
00000000-0000-0000-0000-000000000000, message = Authenticating to the
server https://XXXXappdevteam.visualstudio.com) 14:17:25.449133 Exe
location hash = ce01163e1787840dbffc06817bd93470
After a few minutes, the request times out and the following is added to the log:
System.Net.Http.HttpRequestException: An error occurred while sending
the request. ---> System.Net.WebException: Unable to connect to the
remote server ---> System.Net.Sockets.SocketException: A connection
attempt failed because the connected party did not properly respond
after a period of time, or established connection failed because
connected host has failed to respond 65.52.8.37:443
A colleague from the network team has run a trace against the proxy and confirmed that he can see requests coming from the agent's host server, but no response from visualstudio.com.
I have tried adding the following to the <Configuration> element of VsoAgentService.exe.config
<system.net>
<defaultProxy>
<proxy
usesystemdefault="true"
proxyaddress="proxy address here"
bypassonlocal="true"
/>
</defaultProxy>
What should I check next or where have I gone wrong?
I'm not running as a service, but from the cmd window - behind a proxy configured in Git globally. I had connection issues with the VSTS recommended build agent (the one you download from within VSTS), but using the latest agent on GitHub, which authenticates with PAT, these problems go away:
https://github.com/Microsoft/vsts-agent
I ran into a similar connection error as well despite being able to open the URL in the browser. My problem ended up being related to the proxy. If your proxy requires authentication, you will have to provide the credentials through environment variables if your service is not running as a network account with privileges to the proxy.
Try these steps:
Open CMD prompt
Set VSTS_HTTP_PROXY=http://yourproxy:80
Set VSTS_HTTP_PROXY_USERNAME=proxyuser
Set VSTS_HTTP_PROXY_PASSWORD=proxypassword
Restart the service.

Resources