Publish to Azure Error


 


I recently ran in to an issue I have not seen before. I was trying to publish to Azure App Services from my local Visual Studio 2022 and it failed with an error of:

     "Error 706 Web deployment task failed. (Could not connect to the remote computer ("xxx.scm.azurewebsites.net") using the specified process ("Web Management Service") because the server did not respond. Make sure that the process ("Web Management Service") is started on the remote computer. Learn more at:http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)"

It took me a couple of hours to troubleshoot and resolve this issue. This post is to document what I did to fix the error so next time I run into this error; I have documentation on how to resolve it.

Process Followed

I have always published my blog post sample code to Azure App Services from my local machine for a number of years. I think this might have been the first time using Visual Studio 2022, that might have been the variable that changed. 

I went to publish a new application using the same process I always have done:

    •  Click publish in Visual Studio
    •  Select Azure as the target
    •  Select Azure App Service
    •  Select My subscription
    •  Selected an unused instance
    •  Then clicked Finish
 
Once back to the publish screen, I clicked publish. The application built and then I received the popup error.

Troubling Shooting Steps

I tried a couple of times just to make sure. Then I tried the following, but all had the same result: 

For step 5, I selected a new instance 

  1.   I cleaned out the publish profiles I had
  2.   Tried again with a new publish profile
  3.   Starting Googling for a resolution
  4.   Several google results stated to put this setting in the Application App settings
    1.  WEBSITE_WEBDEPLOY_USE_SCM = False
    2.  I placed it first in my local app settings file
    3.  I then added it as an application setting in the configuration in Azure for the App service
  5.   In Azure I downloaded a new publish profile and used that one
  6.   In Azure I reset the publish profile and tried that one.
  7.   Then in Azure I deleted the old App Service instance and created a new one.
    1.   Repeated b and c from above
  8.   An article stated you had to be an Admin to publish
  9.   Closed Visual studio
  10.   Opened as Admin
  11.  Tried to publish again 

It was at this point I was getting frustrated. I decided to take and break. Taking a break turned out to be a clever idea. As I started troubleshooting again, I remember a comment of a comment on a Stock Overflow. It stated this is a local error and to check your firewall.


Resolution

I searched and found that Visual Studio uses TCP Port 4026. I opened my fire wall on my Windows 11 desktop and sure enough the post was blocked. I opened the port. At this port I was able to publish to Azure. 

I figured I had fixed the issue and moved on to the next step in my project. The next day I started a fresh instance of Visual Studio made changes and tried to publish and it failed, again. I double checked the port, and it was fine. That's when it dawned on me that I was also signed in as admin the last time I published. I exited visual studio and started it as admin. I was now able to publish.

 

Full Resolution

    1. Ensure port 4026 is open for TCP
     2. Start Visual Studio 2022 as administrator
 

I am not sure if these are new requirements for Visual Studio 2022 or something in Windows 11 change the security. Either case, it cost me several hours to investigate and resolve this issue. Hopefully posting this will help someone else save a little time.

 

Comments

Popular posts from this blog

Yes, Blazor Server can scale!

Blazor - Cool Blur Loading Page

Blazor new and improved Search Box