By using Visual Studio, you can publish your website directly to an Azure Virtual Machine. After selecting the VM in the Publish wizard, you may come across this error message: “Could not reach the Web Deploy endpoint on the specified virtual machine“
Solution for “Could not reach the Web Deploy endpoint” error
Turn off Windows Firewall to see if the issue occurs again. You can turn it back on after testing. If it works after turning it off, it means there is an issue with the inbound rule.
In order for Web Deploy to access a virtual machine, that machine should be listening the port 8172. Run the command below in the VM to see if it is listening to this port:
netstat -ano | findstr :8172
Then, make sure that IIS Management Service is installed and running:
Finally, go to IIS Manager and open “Management Service”. Check if it is enabled for remote connections.
Are you seeing “Remote Debugging Monitor (MSVSMON.EXE)” error while publishing your project in Visual Studio? Here is the solution: Solved: “Remote Debugging Monitor (MSVSMON.EXE)” error while running a Visual Studio project
“Could not verify the server’s certificate” error
After solving the “Could not reach the Web Deploy endpoint” error, we run into another issue while trying to publish the web application:
Web deployment task failed. (Connected to the remote computer (“testsite.azure.com”) using the specified process (“Web Management Service”), but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.) Connected to the remote computer (“technewsinfo.centralus.cloudapp.azure.com”) using the specified process (“Web Management Service”), but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.The remote certificate is invalid according to the validation procedure.
In order to solve this issue:
- Check “Allow untrusted” option in the Publish wizard if it is available (Reference)
- Add the lines below to your publish profile (Located in
- Reinstall msdepsvc (MS Deploy service for Remote Agent)
Is your Azure Virtual Machine receiving too many requests from a certain IP address? Check this post out: IIS receives too many requests from the user-agent Edge+Health+Probe
Solution for “Could not connect to the remote computer 404 Not Found” error
I wanted to mention a similar Web Deploy related issue. While trying to deploy your application from Visual Studio to IIS website, you may run into the error below.
Could not connect to the remote computer. On the remote computer, make sure that Web Deploy is installed and that the required process (“Web Management Service”) is started. Learn more at https://docs.microsoft.com/en-us/iis/publish/troubleshooting-web-deploy/web-deploy-error-codes#error_destination_not_reachable. The remote server returned an error: (404) Not Found.
One of the most common causes of this issue is the missing management component for the Web Deploy installation. In order to solve it, uninstall and install Web Deploy back by selecting all components in the wizard.
If you are migrating your websites from one server to another, check out this post: How to migrate website between IIS servers using Web Deploy (msdeploy)