0

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 :

  1. On Google Compute Engine, I've created an instance for ASP.NET on a windows server 2016 machine.
  2. I've changed the windows password and noted the: Username and Password.
  3. On Visual Studio 2022, I've installed the Google Cloud Tool.
  4. On the Google Cloud Tool, I've linked the google account I use for Google Cloud.
  5. On the Google Cloud Tool, I've pressed "Publish to Google Cloud" and then pressed "Compute Engine".
  6. I've selected the right project ID, the right VM instance and I wrote the right Account user name and password from step 2.
  7. 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 ==========
Ermiya Eskandary
  • 15,323
  • 3
  • 31
  • 44
Jeremwhy
  • 11
  • 2
  • 1
    What steps did you follow to configure the Web Deployment Agent Service on Windows (Compute Engine)? An option would be to select an image that has this already configured. Go to Cloud Marketplace and select one of the .NET images. – John Hanley May 29 '22 at 01:46

1 Answers1

0

I was with the same problem and I wasn't able to publish using the Google Cloud tools ("Publish to Google Cloud" button).

I use the normal "Publish" button.

First

You need to install the Web Deployment Agent Service in your VM instance and install Web Deploy 3.5 https://learn.microsoft.com/en-us/iis/install/installing-publishing-technologies/installing-and-configuring-web-deploy-on-iis-80-or-later

Second

Create your publish profile: https://codelabs.developers.google.com/codelabs/cloud-compute-engine-aspnet#6

(to know your Site Name remote access your VM instance > IIS > Sites and make sure if it really is "Default Web Site")

That's it! This should work

BUT If you still can't make this work, you probably got the error

Web deployment task failed. (Could not connect to the remote computer ("###.###.###.###") 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: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_COULD_NOT_CONNECT_TO_REMOTESVC.)

if that happened, this thread should be able to help you.

Web deployment task failed. Could not connect...server did not respond

For me, this error happened and it was because I was passing my Host Name instead of "Default Web Site" but this can vary.

Good luck!

Mr. Ott
  • 311
  • 1
  • 4
  • 12