I want to deploy a website that I've made with ASP.NET 6.0 on GCP. The website is fully functional in localhost, but when I try to publish it, I get this error in my Visual Studio 2022 Output :
Publishing MyProject to Compute Engine.
Failed to publish project MyProject .
I've tried a lot of things to make it work, but still can't figure the problem. Here are the steps I've done :
- On Google Compute Engine, I've created an instance for ASP.NET on a windows server 2016 machine.
- I've changed the windows password and noted the: Username and Password.
- On Visual Studio 2022, I've installed the Google Cloud Tool.
- On the Google Cloud Tool, I've linked the google account I use for Google Cloud.
- On the Google Cloud Tool, I've pressed "Publish to Google Cloud" and then pressed "Compute Engine".
- I've selected the right project ID, the right VM instance and I wrote the right Account user name and password from step 2.
- I've pressed "Publish".
This is what I got,
Output of VS 2022 :
Publishing MyProject to Compute Engine.
Failed to publish project MyProject.
The problem is that I can't see more information on why the deployment failed.
I've also tried to use the deploy service of Visual Studio 2022, and I get this error :
Build started...
1>------ Publish started: Project: MyProject, Configuration: Release Any CPU ------
MyProject-> C:\Users\MyProject\Desktop\MyProject\MyProject\MyProject\MyProject\bin\Release\net6.0\whatmain_support.dll
MyProject-> C:\Users\MyProject\Desktop\MyProject\MyProject\MyProject\MyProject\obj\Release\net6.0\PubTmp\Out\
C:\Program Files\dotnet\sdk\6.0.202\Sdks\Microsoft.NET.Sdk.Publish\targets\PublishTargets\Microsoft.NET.Sdk.Publish.MSDeploy.targets(140,5): Error : Web deployment task failed. (Could not connect to the remote computer ("ip.ip.ip.ip") using the specified process ("Web Deployment Agent Service") because the server did not respond. Make sure that the process ("Web Deployment Agent Service") is started on the remote computer. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)
Could not connect to the remote computer ("ip.ip.ip.ip") using the specified process ("Web Deployment Agent Service") because the server did not respond. Make sure that the process ("Web Deployment Agent Service") is started on the remote computer. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.
The remote server returned an error: (503) Server Unavailable.
Publish failed to deploy.
1>Build failed. Check the Output window for more details.
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========