Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSDeploy doesn't deploy to remote server using MSBuild and Visual Studio 2010

I'm currently running Visual Studio Team System 2010 RC and I'm trying to get the Build Service setup to build my solution and deploy 3 web applications in it. I've created a custom build configuration called Integration and I've setup the "IIS Web site/application name to use on the destination server" on the Package/Publish tab of the Properties for each of the web applications.

In my Build Definition I've set the following arguments:

/p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MSDeployPublishMethod=InProc /p:MsDeployServiceUrl=http://my-server-name:8172/msdeploy.axd /p:EnablePackageProcessLoggingAndAssert=True

However, when I run the build I get the following error, for all three web applications:

Updating setAcl (MyProjectName).

C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3481,5): error : Web deployment task failed. (Attempted to perform an unauthorized operation.)

I don't think this is my actual problem though. This error is occuring after the following entry in the log: Updating setAcl This is what's causing the error message, but it appears that MSDeploy is trying to deploy to the local IIS on the Build server, not the server I specified with the MsDeployServiceUrl parameter.

After looking at the targets file at C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets, I added the EnablePackageProcessLoggingAndAssert, which adds extra logging. The log shows an emptry string for the value of MsDeployServiceUrl. I also noticed in the target that MsDeployServiceUrl has a lowercase s, which is somewhat confusing because the task name MSDeployPublish has an uppercase S. I tried using it using uppercase, then again using lowercase, but neither worked.

A couple other things to note:

  1. My build service is running as NETWORK SERVICE.
  2. The server I'm trying to deploy to is on another domain.
  3. I also tried adding /p:username=mydomain\myusername /p:password=mypassword to the MSBuild paramter list, but that didn't help.

Does anyone know if I'm supplying the correct parameters? Or provide me with the correct ones?

Thanks

like image 892
Chad Peck Avatar asked Apr 15 '10 17:04

Chad Peck


People also ask

Can't connect to remote server web deploy?

This error indicates that you cannot connect to the server. Make sure the service URL is correct,firewall and network settings on this computer and on the server computer are configured properly,and the appropriate services have been started on the server.

Could not connect to the remote computer make sure that the remote computer name is correct?

If you cannot connect using the remote computer name, try using the IP address instead. You can use ipconfig in a command line on the remote computer to get the IPv4 address. If you are using a HOSTS file, verify that it is configured correctly.

How do I deploy a website using Visual Studio?

You can publish your web app to both local and network folders. First, provide the path and click Finish to complete the Publish wizard. Next, you see the summary page for the new publish profile that you just created using the Publish wizard. Click Publish and Visual Studio deploys your web app to the provided path.


1 Answers

After many rounds of changing the parameters, I was able to find a solution and get the build to deploy successfully. The parameters that I ended up using were:

/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish 
/p:MSDeployPublishMethod=**RemoteAgent** 
/p:MsDeployServiceUrl=http://my-server-name
/p:username=myusername 
/p:password=mypassword

It appears that when using InProc for the MSDeployPublishMethod MSBuild ignores MsDeployServiceUrl and always tries to deploy to the local server. I changed it to RemoteAgent and it deployed successfully. I did notice that the Package file is nolonger contained in the MyWebApplication_Package folder, but that isn't a big deal to me.

like image 134
Chad Peck Avatar answered Sep 21 '22 04:09

Chad Peck