Azure Linux Publish Error (Web deployment task failed. Could not connect to the remote computer)

Azure App Service on Linux was released by Microsoft in 2017. It makes it easy to run your website on ASP.NET Core, Node.js, PHP, Ruby or you own custom Docker Container.

Most people (including me) run into this common problem the first time they try to deploy a Linux Web App. This is easily solved. I will show you how.

Web deployment task failed. Could not connect to the remote computer.

Web deployment task failed. (Could not connect to the remote computer ("linuxtest1.scm.azurewebsites.net"). 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.) The requested resource does not exist, or the requested URL is incorrect.

This is how you solve the problem

  1. Go into the Azure Portal ≫ Your App Service ≫ Settings ≫ Configuration ≫ Application Settings.

  2. Add a new setting under Application Settings: WEBSITE_WEBDEPLOY_USE_SCM and set the value to false. Leave "Deployment slot setting" blank. Don't forget to click Save.

Azure Linux Web App Configuration disable SCM
  1. Now download a new updated publishing profile for Visual Studio.
Azure Web App get publish profile
  1. Import the publish profile in Visual Studio. Voila! Your problem should be solved!

What does the WEBSITE_WEBDEPLOY_USE_SCM setting actually do?

Windows Azure Websites comes with SCM, an extension/plugin, that enhance the manageability of the website. This includes the Kudu dashboard (also known as the SCM dashboard) that includes many nifty tools, such as:

  • Accessing your website files
  • Accessing logs
  • Connecting through SSH/Bash/Command Prompt
  • Accessing System Info, App Settings, Environment Variables and HTTP Headers

You can access the Kudu dashboard by visiting https://{site name}.scm.azurewebsites.net (or by going to Developer Tools ≫ Advanced Tools in the Azure Portal).

Kudu/SCM is available both for Windows Web Apps and Linux Web Apps in Azure.

SCM is also used by default for publishing your web apps. However, this seems to not be working for Linux Web Apps, so you need to use the legacy deployment endpoint instead. This is what WEBSITE_WEBDEPLOY_USE_SCM = false actually does.