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 ==========
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!
I am trying to publish a website from my computer to an IIS web server via web deploy.
I have 3 servers. All servers have installed the same things (Webdeploy etc.) and the services are started (Web Deployment Agent Service and Web Management Service).
On the first server I have no problems on connecting. But the other two servers give me some error when I "Validate Connection" in Visual Studio to the IIS. When I look at the logs on the IIS server, there are my accesses listet with html code 200 (ok).
An error ocurred when the request was processed on the remote computer. Filename: MACHINE/WEBROOT
Error: The configuration section 'system.webServer/management/delegation' cannot be read because it is missing schema
I really have no idea what could solve this problem and hope you are able to help me.
I had the exact same problem, it turned out I had installed Web Deploy 3.6 on top of 3.5. Remove Web Deploy 3.6 and reinstall 3.5 and see if it solves your issue.
You can also try #james-wilkins comment below: "In my case I installed Web Deploy BEFORE installing the management service..."
Uninstall and then re-install Web Deploy.
This fixed the problem for me -- the 'repair' option in the installer did not.
In my case, I installed Web Deploy BEFORE installing the management service. I tried to do a "change" on the install to include the management service (or you can add the feature from add/remove windows features), but that didn't help (got the error on this post). In the end, a simple uninstall and reinstall of 3.6 was what worked for me. Seems it needs the Web Management Service to be installed FIRST. Typical MS instructions don't even mention this at all.
I am publishing my web app in Azure. The following Error appears:
Error 12 Web deployment task failed. (Could not complete an operation with the specified provider ("dbDacFx") when connecting using the Web Management Service. This can occur if the server administrator has not authorized the user for this operation. dbDacFx http://go.microsoft.com/fwlink/?LinkId=178034
I have tried to un-install all Web Deploy folders in my Program Files Folder but even with nothing opened, it is telling me it is in use and that I can't delete the folder. I have since installed the newest version of Web Deployment.
Any ideas would be greatly appreciated!
From the error message it can be several things. But I can suggest at first to check if you are creating or altering Database schema behind the application. If so that can be the issue. For instance the user executing the script has no enough rights to perform the desired task.
Please see Azure SQL docs to grant correct sql rights to the user.
I'm integrating MSDeploy into my build process, and having problems authenticating. The following command works fine:
msdeploy -verb:sync -source:appHostConfig="KitchenPC",computerName=192.168.0.3,userName=Administrator,password=secret -dest:package=c:\DeployTest\KPC.zip
However, this does NOT work:
msdeploy -verb:sync -source:appHostConfig="KitchenPC",computerName=192.168.0.3,userName=kpcpublish,password=secret -dest:package=c:\DeployTest\KPC.zip
And yields the error:
Error Code: ERROR_USER_NOT_ADMIN
More Information: Connected to '192.168.0.11' using the Web Deployment Agent Service, but could not authorize. Make sure you are an administ
rator on '192.168.0.11'. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_ADMIN.
Error: The remote server returned an error: (401) Unauthorized.
Error count: 1.
I've followed the instructions in the link above, and any other docs I could find, which pretty much all say the same thing:
I created an account called kpcpublish
I added this account to a group called MSDepSvcUsers - Heck, I even added the account to Administrators
I right clicked on the site and selected Deploy->Configure Web Deploy Publishing and added kpcpublish to the list. It says the following:
.
Publish enabled for 'SERVER\kpcpublish' Granted 'SERVER\kpcpublish'
full control on 'C:\Website' Successfully created settings file
'C:\Users\Administrator\Desktop\SERVER_kpcpublish_KitchenPC.PublishSettings'
There must be some step I'm missing, but I just can't figure out what could be.
UPDATE:
Using the full HTTP path for the computerName property, I get the error:
Error Code: ERROR_DESTINATION_NOT_REACHABLE More Information: Could
not connect to the remote computer ("192.168.0.3"). On the remote
computer, make sure that Web Deploy is installed and that the required
process ("Web Management Service") is started. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DES
TINATION_NOT_REACHABLE. Error: Unable to connect to the remote server
Error: A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection fa
iled because connected host has failed to respond 192.168.0.3:8192
Error count: 1.
I've checked and the Web Management Service is indeed running.
Another Update:
I've completely paved the system and set it up again from scratch. I've done nothing out of the ordinary, just installed the IIS role and made sure to check "Management Service" under Management Tools, which is required for WMSVC to run. I then installed Web PI, and installed "Recommended Configuration for Hosting Providers", which will install Web Deploy 3.0. However, I did notice there was an error while installing this (I believe I got this error the last time as well). It looks like:
I've also attached the log files here.
I then tried to install Web Deploy 3.0 manually, however it says it's already installed. Next, I downloaded the MSI directly from http://www.iis.net/download/webdeploy and ran it in "Repair" mode. That seems to have worked. I also noticed that the WMSVC service is up and running. So this looks good.
Still, MSDeploy will not connect. I thought it might be some sort of firewall issue, so I ran it locally. I've tried using both HTTPS and HTTP to connect. HTTPS gives me an error, HTTP just times out after 2-3 minutes.
HTTPS:
msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=https://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
Info: Using ID 'f3a54096-adc4-4f54-9e4f-ad8fde12edb6' for connections to the remote server.
Error Code: ERROR_CERTIFICATE_VALIDATION_FAILED
More Information: Connected to the remote computer ("staging") using the specified process ("Web Management Service"), but could not verify the server's certifi
cate. 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.
Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Error: The remote certificate is invalid according to the validation procedure.
Error count: 1.
HTTP:
msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=http://STAGING:8172/msdeploy.axd,userName=Administrator,password=Khorf123 -dest:package=c:\DeleteMe.zip
Info: Using ID 'ebee66f0-08e5-4d9d-98ea-0c2e59784895' for connections to the remote server.
Error: Could not complete the request to remote agent URL 'http://staging:8172/msdeploy.axd'.
Error: The operation has timed out
Error count: 1.
(Updated 2016-03-07 - NOTE: non-Administrator deployments also require ?site=IIS_SITE_NAME after msdeploy.axd, otherwise the connection is treated as global and requires Administrator access)
Not sure how missed this originally, but your problem is the computerName parameter. Non-administrator deployments are only supported when using WMSVC, for which you need to specify the full URL.
Try the following
msdeploy -verb:sync ^
-source:appHostConfig="KitchenPC",computerName=https://192.168.0.3:8172/MsDeploy.axd,userName=kpcpublish,password=secret,authType=Basic ^
-dest:package=c:\DeployTest\KPC.zip
From the docs:
The computer name will be translated to the default Web Deploy URL. For example, computerName=Server1 will become http://Server1/MsDeployAgentService. If the remote service is running with a custom port or URL, you must specify the full URL
And from the install instructions:
The MSI will not install the Web Management Service handler component if the Web Management Service is not installed; the handler component is necessary for non-administrator deployments
(I couldn't find a more explicit canonical source that describes WMSVC as a requirement for non-admin deployments)
Figured It Out!
So, it seems that (at least by default), WMSVC only listens on HTTPS, and HTTP will just time out. However, since my certificate was self-signed, I had to use the -allowUntrusted command line option.
That was almost enough. I also had to specify authType=Basic like Richard originally suggested. So, to put it all together, this is the MSDeploy command line that will actually work:
msdeploy -verb:sync -source:appHostConfig="Default Web Site",computerName=https://192.168.0.3:8172/msdeploy.axd,authType=Basic,userName=Publish,password=secret -dest:package=c:\DeployTest\KPC.zip -allowUntrusted
After configuring Web Deploy my server as follows. I continued to get HTTP 404 connection failures. In may what worked for me was the following additional efforts...
Uninstall all previous version of Web Deploy that existed. I was not even aware they existed; however, previous versions appear to conflict with completing a connection to the latest Web Deploy service. Newer version don't uninstall their predecessors. In the last part, I was getting HTTP 401.7 - File Extension Denied.
For good measure, performed a repair of the current version of Web Deploy, currently Microsoft Web Deploy 3.6
For good measure, recreate and import my Visual Studio 2013 deployment profile...
recreate the publish settings file using the Configure Web Deploy Publishing dialogue available from the Deploy context menu option of the target website in IIS Manager's Connections panel. (Note, the publish settings file will be recreated when you press Setup as the file whose full path is specified in the dialogue entry, Specify a location to save the publish settings file)
Copy or otherwise make the publish settings file available to Visual Studio and selecting Publish from your project's context menu, create a Visual Studio publish profile by importing the publish settings file.
Try restarting the wmsvc service on the target machine
As alluded to above, make sure that you are connecting over HTTPS. If you are attempting to connect as Admin, but not using SSL, you get the following error:
Error Code: ERROR_USER_NOT_ADMIN
More Information: Connected to 'host' using the Web Deployment Agent Service, but could not authorize. Make sure you are an administrator on 'host'.
(Where 'host' is your server name)
For me the problem was that my password expired... I've noticed it when loging out and then tried to login back trhough remote desktop.
I am new to Azure Accelerator for web roles I have performed each step on the guidance from the net but I am getting an error when I try to deploy my website.Everything is rechecked by me WMSvc is running and is set to auto and username and password is correct but I dont understand where is the problem.
Error 1 Web deployment task failed.(Remote agent (URL http://2f96c9ab6cda4281bcf25a899d66955d.cloudapp.net/MSDEPLOYAGENTSERVICE) could not be contacted. Make sure the remote agent service is installed and started on the target computer.) Make sure the site name, user name, and password are correct. If the issue is not resolved, please contact your local or server administrator. Error details: Remote agent (URL http://2f96c9ab6cda4281bcf25a899d66955d.cloudapp.net/MSDEPLOYAGENTSERVICE) could not be contacted. Make sure the remote agent service is installed and started on the target computer. An unsupported response was received. The response header 'MSDeploy.Response' was '' but 'v1' was expected. The remote server returned an error: (401) Unauthorized. 0 0 QuickMVCdep
Please help me to find the solution so that I can deliver my project to Client.
I have run into the same issue.
It appears that the Publish action from the VS Azure tools will set up the MSDeploy correctly as part of the deployment process, but creating a package from VS and then upgrading the server using the Azure portal will not. Which is a bummer since the VS Publish action deletes the deployment and then recreates it, which will reassign your VIP address.
I haven't been able to pinpoint the difference, but one thing I've noticed is that if you do a Publish from VS, MS Web Deploy 2.0 will be installed for you, whereas I don't believe it is when you run an Upgrade. That said, I've never managed to manually install/configure the right bits on an Azure server to enable MSDeploy (I suspect that there is some LB/firewall configuration that happens outside of the host to allow traffic to 8172).
All in all, MSDeploy is useful enough during development that I prefer that pain (which requires me to change my A record in my DNS every time I do a major upgrade) over the alternative (Upgrade using the portal and lose the ability to use MSDeploy).
I would love to learn of a solution where we can have our cake and eat it too (an upgrade package that allows MSDeploy'ing a web role).