How do I fix an "ERROR_PROXY_GATEWAY" error while deploying with Azure App Service deployment in combination with -useCHECKSUM - msbuild

I have setup a self hosted release agent for releasing my software to an Isolated App Service. If I deploy this using the Azure App Service deployment task (V4), this works just fine. I want to use the -useCHECKSUM option but this breaks the release. I get an error stating: "Error: The remote server returned an error: (502) Bad Gateway."
I have tried google-ing for the error but I could not find any relation between the parameter and the Error. I suspect the -useCHECKSUM is using a different route to deploy the Application but I cannot find out what it is using.
More Information: Could not connect to the remote computer ("xxxxxxx") using the specified process ("Web Management Service"). This can happen if a proxy server is interrupting communication with the destination server. Disable the proxy server and try again. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_PROXY_GATEWAY.
Error: The remote server returned an error: (502) Bad Gateway.
Error count: 1.
2019-07-31T08:38:16.5670711Z ##[debug]task result: Failed
2019-07-31T08:38:16.5680985Z ##[error]Error: Error Code: ERROR_PROXY_GATEWAY

Related

Migrate .NET Core app from Google App Engine to Google Cloud Run - SQL connection issues

I have a .NET Core API currently running in App Engine and everything is working fine there. I am connecting to the database by following Google provided example, defining cloud sql instance in app.yaml:
beta_settings:
cloud_sql_instances: <sql connection name>
Along with env variables like DB_HOST: cloudsql and other credentials.
Note that I am using a custom runtime and provide the dockerfile myself.
While trying to deploy my app to Cloud Run, I've tried setting up the environment variables in the same way as I am providing them in my app.yaml file, as well as providing cloud sql connection name and adding it (note that I could not see the connection name I want, out of 4 existing SQL instances I could only see 2), the same one I use in my app.yaml. Deployment fails with an error:
Unhandled exception. Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or
instance-specific error occurred while establishing a connection to SQL Server. The server was
not found or was not accessible. Verify that the instance name is correct and that SQL Server
is configured to allow remote connections. (provider: TCP Provider, error: 35 - An internal
exception was caught)
I've tried following this post, but still nothing changed. Other attempts:
I've configured my SQL instance to have a private IP assigned and tried using it at DB_HOST field, still got the exception
Tried changing SQL connection name to other instances (appropriately changing environment variables), still got the exception
Created a VPC Connector and added it to my revision, still got the same error.
How can I fix this? What am I doing wrong?
If you are migrating an existing web application, see Migrating Your Service to Cloud Run.
Check if your app meets all the criteria for Cloud Run.
Checked this document about connecting to a Cloud SQL instance from a service running in Cloud Run. The steps to configure Cloud Run depend on the type of IP address you assigned to your Cloud SQL instance. You can also check about connection options.
You can follow this example about Google Cloud SQL with MySQL for Cloud Run.
It could be helpful to check this SO post about the correct Cloud SQL connection string syntax for dotnetcore app with Cloud Run.
Alright so I managed to make it work by following this quickstart guide, it's quite confusing really to have many different sources about Cloud Run connecting to SQL. Adding the environment variables mentioned in the guide solved the issue.

MSDeploy Fails with "Error: The underlying connection was closed: An unexpected error occurred on a send."

Hello guys I'm struggling over here....
I'm unable to solve this problem no matter what I do.
I have two web servers both with IIS Management enabled, I run a build from my build server and then depending which environment it goes to the MS deploy URL changes but the command looks like this:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='E:\data\teamcity\BuildAgent\work\d9f8b686a8037f97\webdeploy_UAT\BuildCode_UAT.zip' -dest:auto,computerName="https://SERVER.DOMAIN.LOCAL:8172/MsDeploy.axd",userName="\username",password="******",authtype="Basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"E:\data\teamcity\BuildAgent\work\d9f8b686a8037f97\webdeploy_Review\BUILDCODE_UAT.SetParameters.xml" -allowUntrusted
I've also created a sample command in my testing as well that doesn't work to the production web server either:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:dump -source:iisapp="Default Web Site",computername=https://SERVER.DOMAIN.local:8172/,authType=NTLM -verbose -whatif -allowuntrusted
I understand this wouldn't actually do anything however, I would receive a different error than what I've been receiving:
Error: Could not complete the request to remote agent URL 'https://SERVER.DOMAIN.local:8172/'.
Error: The underlying connection was closed: An unexpected error occurred on a send.
Error: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
Error: An existing connection was forcibly closed by the remote host
Error count: 1.
These commands generate feedback upon executing them against my dev server, that server works properly and I'm still able to deploy.
This process has been setup and working for years, however; over the weekend my infrastructure team did install windows updates and then when come Monday morning, we were no longer able to deploy to that server.
What I've done:
Rolled back all of those updates
Restored the VM prior to installing the updates
Confirmed not network or firewall issue as I am able to telnet from the build server over port 8172 to the server in question...Also, I tried running the command on the server itself changing the URL to localhost and it still doesn't work
Rebooted
Ran a repair against .NET 4.7.2
Ran a repair against Web deploy 3.0
Regedits were in place to enable all TLS
Ran a powershell script to dump TLS settings to confirm that I wasn't reading the regedits incorrectly
Compared TLS settings with my dev server - all good
Added SchUseStrongCrypto regedits on my build server - no change
I'm unable to even receive any feedback other than "connection closed" When trying to hit the URL via a browser
So finally, I installed fiddler on my computer; setup my connection in Web management console to allow my IP and tried to hit the URL while in fiddler and this is what I receive:
HTTP/1.0 200 Connection Established
FiddlerGateway: Direct
StartTime: 13:30:10.019
Connection: close
fiddler.network.https> HTTPS handshake to SERVER.DOMAIN.local (for #21) failed. System.IO.IOException
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
To me, that suggested something was wrong with the SSL cert, I created a new self signed cert in IIS and applied the certificate via management console, still doesn't work!!
Help me!!!! Thanks in advance!

SQLExpress database file auto-creation error - after deploying to Azure

Was going about with our usual deployment of code (ASP.NET MVC solution) to Azure to a test instance as an App service. The solution works on local machine, but started throwing this exception in Azure.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
* SQLExpress database file auto-creation error: *
Unfortunately this seems to be happening even for other environments now. I haven't changed anything there except redeploying. This has nothing to do with connectionString, have triple checked it on the server itself. Basically the solution as it is works, and have been working for all this while, but since last week all new deployments are failing with this error. Even re-deploying the old code seems to fail. I am afraid to try it on any new environments.
No recent changes were made to web.config, all that was updated was some UI components. In any case, even the older code that is running on other environments are failing. Any ideas on why this could be happening?
SQLExpress only exists within Visual Studio. On something like Azure, you need a connection string that points to a real instance of a SQL Server database.

WebDeploy gets Unauthorized error while deploying via remote Web Deployment Agent

I have a remote server (Win2008R2) with WebDeploy 3.0 installed on it. Web Management Service isn't installed on it (actually I tried to install it but it cannot be contacted due to closed ports on my side).
I'm trying to deploy a package (zip) to the server via local WebDeploy 3.0 tool.
Server.deploy.cmd /T /M:myserver.no-ip.org "/U:myserver\Administrator" "/P:pwd" /A:Basic
I tried both Basic and NTLM auth methods.
I'm getting error:
Error Code: ERROR_USER_NOT_ADMIN
More Information: Connected to 'myserver.no-ip.org' using the Web Deployment Agent Service, but could not authorize. Make sure you are an administrator on 'myserver.no-ip.org'. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_ADMIN.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
Please note that I'm actually connectin to WebDeploy Agent Service not Web Management Service. That's important as there are tons of info how to setup WMSrc with WebDeploy.
I know that WebDeploy Agent only supports connecting as Administrator. That is my case - I'm specifying the remote server Administrator credentials.
I tried to open WDAgentSrc url in the browser. I was promted for creditials and they were accepted.
I checked "Microsoft Web Deploy" log in the Event viewer - it's empty.
How to get it working?

Trouble with MS Remote Web Deploy II6 6

I am getting the following error when I run web deploy:
>C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets (3588): Web deployment task failed.
((3/25/2011 4:41:36 PM) An error occurred when the request was processed on the remote computer.)
(3/25/2011 4:41:36 PM) An error occurred when the request was processed on the remote computer. The entry type 'Unknown' was not expected at this time. The serialization stream may be corrupted.
I have successfully done this on other IIS6 machines with no issues so I don't understand what is going on. The Remote Deployment Service is running and just to see if it mattered I started the service under an administrative group. That did not help.
Any help would be great.
I found that the 2008 server with IIS 7 did not have all of the components installed. Even though Web Deployment 2.0 seemed to have been installed by the Web Platform Installer, there were components that were incomplete due to communication issues with the MS servers. In order to resolve this, I had to download the installation files on a separate machine, copy them to the server and then reinstall everything. Very vague error for such an odd issue.