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:
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:
• Select Azure as the target
• Select Azure App Service
• Select My subscription
• Selected an unused instance
• Then clicked Finish
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
- I cleaned out the publish profiles I had
- Tried again with a new publish profile
- Starting Googling for a resolution
- Several google results stated to put this setting in the Application App settings
- WEBSITE_WEBDEPLOY_USE_SCM = False
- I placed it first in my local app settings file
- I then added it as an application setting in the configuration in Azure for the App service
- In Azure I downloaded a new publish profile and used that one
- In Azure I reset the publish profile and tried that one.
- Then in Azure I deleted the old App Service instance and created a new one.
- Repeated b and c from above
- An article stated you had to be an Admin to publish
- Closed Visual studio
- Opened as Admin
- 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
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
Post a Comment