how to fix ERROR_DESTINATION_NOT_REACHABLE error in azure web app deployment using VSTS - azure-devops

I am using VSTS pipeline to deploy asp.net core 2.2 MVC to azure web app.
The last step which is deploy to azure fails - please see the error below:
##[error]Failed to deploy web package to App Service.
2019-01-08T21:39:47.3810424Z ##[error]Error Code:
ERROR_DESTINATION_NOT_REACHABLE More Information: Could not connect to
the remote computer ("our website url"). On the remote computer, make
sure that Web Deploy is installed and that the required process ("Web
Management Service") is started. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE.
Error: Unable to connect to the remote server Error: 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 ????:443
I even tried to Take App Offline but no luck:
However, it works fine if I publish the web app through Visual studio.

The problem was the subscription we were using has a firewall in place. So there was no way to get into firewall by even doing things like adding "WEBSITE_WEBDEPLOY_USE_SCM" = false in the app setting of web service.
The only solution we could think of was to create an agent inside a VM sitting inside the same firewall.

Recreate web app in Azure Portal -> Make sure target framework selected correctly.
I had accidentally set this to docker previously during my web app setup in the portal and this error was produced as well. I was using a MVC .NET 4.7 project and trying to use web deploy.
Hopefully this helps someone who has perhaps set up their web app incorrectly in the azure portal.

Related

Failed to deploy web package to IIS website. By the Self-hosted Windows agent

Failed to deploy web package to IIS website
I have created one ASP.NET Core application and Azure DevOps continuous integration (CI) and continuous delivery (CD) pipeline.
I have created and configure the Self-hosted Windows agents in my local machine as a service. It is working as expected.
When I run the CI/CD pipeline for the first time it is working successfully, and the web application published to my local IIS successfully.
The issue is when I commit another update to Azure DevOps git repository it is failed to deploy web package to my local IIS website with the following errors and warnings
2019-08-21T10:56:59.1480862Z ##[error]Failed to deploy web package to IIS website.
2019-08-21T10:56:59.1492670Z ##[warning]Can\'t find loc string for key: Trytodeploywebappagainwithrenamefileoptionselected
2019-08-21T10:56:59.1493093Z ##[warning]Trytodeploywebappagainwithrenamefileoptionselected
2019-08-21T10:56:59.1493421Z ##[error]Error Code: ERROR_FILE_IN_USE
More Information: Web Deploy cannot modify the file 'DemoWebApp.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.
Error count: 1.
I have configured the appOffline rule in the publishing profile (.pubxml) and add the EnableMSDeployAppOffline element to the PropertyGroup like this:
<PropertyGroup>
<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
</PropertyGroup>
As described in More Information’s learn more URL http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.
Still it is failed to deploy web package to my local IIS website with the same errors and warnings.
When I trying to redeploy manually few times then it is working successfully other wise failed with same errors and warnings. Because I think the file is locked for some time in my local machine process.
It is also working successfully when I manually delete all the files from IIS release folder with that locked file.
Needs help, the file is locked by any one local process. I couldn’t find that local process. I couldn’t figure out the issue. I also don’t know if I found that process any how then how to figure out the issue. Is this just local issue?
Can anyone help me out?
Recycle the application pool immediately before your 'Deploy IIS App' task.
Add a 'WinRM - IIS Web App Management' task to you release pipeline. Set the Configuration type to 'IIS Application Pool', set the 'Action' to Recycle, and type in the app pool name in the 'Application pool name' field.
The recycle should unlock the dll and allow it to be deleted and replaced in the deployment step.
I encountered this same error despite having the Take App Offline option set for ages. That can't be the solution. There's some phantom bug going on here, but I did get it resolved without rebooting the server.
In PROCMON, I searched Associated Handles for the file in use. There were none.
I tried deleting the app's DLL file outright; an error message said it was in use by w3wp.exe even though the website was offline and the app pool stopped.
I confirmed this by opening IIS and looking at the worker processes panel. None of the active w3wp.exe PIDs were related to the application I was trying to update.
I opened PROCMON and sorted by Image name to find any W3WP.exe instances still running. There was one Suspended instance that it wouldn't let me terminate (despite running PROCMON as an admin/with elevation). It simply said "Access is denied."
I restarted the Agent on the server via the Services window.
At that point, I was able to delete the application DLL from the target directory and deploy normally from DevOps pipelines.
Hopefully this doesn't happen in production.
I had the same error .
I splved by checking the "enable IIS" to my task , like this :
Now my lob suuccseded
I was deploying my web app on local iis using IIS Web App Deploy task.I was able to reproduce the same error. I found this error occurred if i was visiting my website when i was trying to deploy a new version. And the deploy task failed to update the .dll file, since it was in use.
I fixed this error by checking this option “Take App Offline”, See below pic.
Please let me know If you are using different tasks to deploy your web app.

VSTS IIS Web App Deploy fails with return 2148734720

I configured releases same way for a couple of our servers but I have issue with one of them (others work perfectly):
[error]Failed to deploy web package to IIS website.
[error]Error: C:\vstsagent\A2_work_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.0.20\MSDeploy3.6\msdeploy.exe failed with return code: 2148734720
Unfortunately I can't find anything helpful related to this error Code.
My release configuration:
IIS Web App Deploy (Preview)
Deployment group with one specific staging server (I'm using on-premise agent)
Website name: correct name of my website in IIS
Virtual Application: empty field
Package of Folder: zip chosen from build drop artifacts
Selected "XML variable substitution"
Selected "Remove Additional Files at Destination"
What I've already tried with no luck:
manually turn of application
delete all files in application folder
changing user account to use for the service
Again - same configuration for other servers works fine.
Servers configuration: Windows Server 2012R2 Standard x64
Looks like I figured it out. .NET Framework 3.5 was missing on my server...
I was investigating logs and I found out that below line is causing failure.
"C:\vstsagent\A2\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.0.20\MSDeploy3.6\msdeploy.exe" -verb:sync -source:package='C:\vstsagent\A2\_work\r2\a\temp_web_package_8269135298977384.zip' -dest:auto -setParam:name='IIS Web Application Name',value='httproot'
So I copied it to CMD and got proper Windows message when I tried to execute it.

Azure Deploy Web App Error with Eclipse

We've previously been able to deploy our Java web application through Eclipse to Azure with no issues, but recently today we kept receiving an error message that says
FTP client can't store the artifact, reply code: 550
Anybody know what Azure is trying to say here ? Why would it suddenly start giving a 550 error? Deploying to a different Azure web application works fine, just can't seem to deploy to the same one as before.
The 550 error code of FTP on IIS normally means deny access or no permission to do some operation. Please try these ways as below.
Restart your Azure WebApp on Azure portal.
Reconfigure the deployment credentials with new username and password on Azure portal.
Remote Administration of Windows Azure Websites using IIS Manager to check the configuration for FTP. For example, there is a similar thread from SuperUser https://superuser.com/questions/845357/iis-ftp-folder-access-issues-550 which you can refer to.
Hope it helps.
The issue can also be caused if there is no webapps folder. Assure that path exists:
/site/wwwroot/webapps/

Unable to Publish .Net backend Service Project into Mobile App service

I have recently migrated my .NET backend Mobile service to App Service, then I tried to publish the updated Service Project to the App Service but it is failing and getting an error saying
Severity Code Description Project File Line Suppression State
Error Web deployment task failed. (Connected to the remote computer ("******.publish.azurewebsites.windows.net") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.)
I have downloaded the Publish Profile from the portal Mobile app command Get Publish Profile option.
Then I imported it to my service project under publish wizard using Import option, I got two profiles one is FTP another one is Web Deploy I tried both option but no luck.
According to the error message it is saying UNAUTHORIZED so, where can I get/see the user name and password of my Mobile App in Azure Portal?
Thanks,
Narendra Macha.
This is a known issue for which a fix is in progress. You can workaround this by adjusting the publish settings to use the scm endpoint for your site, as captured here.

Auto Deploy using Continuous Integration in TFS 2012

I have setup continuous integration for a WCF project and want to use the MSBuild Arguments to automatically deploy the application to a remote server but it is not deploying.
When running a new Build all the Tests pass and all the projects build but the website is not being deployed. Also, I am getting no errors back from the build to say anything has gone wrong.
I have opened up port 8172 on the remote server to ensure connections can be made to IIS and have even disabled the firewall.
In the Build Configuration I have specified the following arguments;
/p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:DeployIisAppPath="Default Web Site/MYSite" /p:MsDeployServiceUrl=http://mysite.com /p:username=MySite\Administrator /p:password=thePassword
I compiled this configuration from the following examples:
http://vishaljoshi.blogspot.co.uk/2010/11/team-build-web-deployment-web-deploy-vs.html
http://www.chrissurfleet.co.uk/post/2011/07/21/Setting-Up-Continuous-Deployment-In-TFS.aspx
I have configured the Server's IIS to enable remote connections and I can Remotely administer IIS from the build server. Also I have successfully deployed the Application using Visual Studio 2012 Publish option.
can anyone see a problem with my MS Build Arguments? Am I missing anything?
Any help would be very grateful
Update:
I have checked the build server to check MS deploy is installed and have installed Web Deploy 3.0 to ensure this is capabale, but has not solved my problem.
I have check the IIS connection logs to see if the remote connection to IIS is being made and there is no connection being made from my build server to the app server.
I have tried running MSBuild.exe for the solution and project on the build server manually with the following:
MSBuild.exe "Project Location" /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=WMSVC /p:DeployIisAppPath="Default Web Site/app" /p:MsDeployServiceUrl=http://appserver:8172/MSDeploy.axd /p:AllowUntrustedCertificate=True /p:CreatePackageOnPublish=False /p:Username=username /p:Password=password
The MSBuild is successfully building the project but is making no attemp to deploy it.
Any Ideas?
Turns out the problem was files were missing on the Build Server as desibried in the Answer to this question:
Similiar problem
Also when installing Web Deploy 3.0 using Web Platform installer not all the features required are installed in order to connect remotely to IIS through MSBuild command line.
I copied the nessesery files from my dev machine to the build server and installed Web Deploy 3.0 manually with all features and this now works!
Maybe there is a bug with TFS 2012???