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:
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 ==========
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-as.net#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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.