3
votes

I am running Windows 7 and IIS 7 with Web Deploy 2.0 installed and the 'Web Management Service' and 'Web Deployment Agent Service' both started.

I am trying to use MSBuild to publish the web projects to a remote IIS 7 server but when I run the following MSBuild command that uses a publish method of MSDeployPublishMethod it fails:

MSBuild Command:

MSBuild Projects="[project file]" Properties="DeployOnBuild=True; DeployTarget=MsDeployPublish; CreatePackageOnPublish=True; MSDeployPublishMethod=WMSVC; MSDeployServiceUrl=http://localhost:8172/MsDeploy.axd; DeployIisAppPath=Default Web Site/[my website]; UserName=[username]; Password=[password]"> /MSBuild

Error:

error : Could not complete the request to remote agent URL 'https://http//localhost:8172/MsDeploy.axd?site=Default Web Site'.

The url appears to be prefixed with https and there is no way to specify http although I can specify http through Visual Studio and publish successfully via the IDE.

When I specify the URL as https:// the same error still occurs:

Error:

Could not complete the request to remote agent URL 'https://localhost:8172/MsDeploy.axd?site=Default Web Site'.

Running the MSBuild command with an MSDeployPublishMethod of InProc works locally however this option does mot allow for deployment remotely.

MSBuild Command:

MSBuild Projects="[project file]" Properties="DeployOnBuild=True; DeployTarget=MsDeployPublish; CreatePackageOnPublish=True; MSDeployPublishMethod=InProc; MSDeployServiceUrl=localhost; DeployIisAppPath=Default Web Site/[my website]; UserName=[username]; Password=[password]"> /MSBuild>

I have also tried using the MSDeployPublishMethod of RemoteAgent but this results in the following error:

Error:

Remote agent (URL http://localhost/MsDeployAgentService) could not be contacted.
Make sure the remote agent service is installed and started on the target computer.

The MSBuild command is as follows:

MSBuild Command:

MSBuild Projects="[project file]" Properties="DeployOnBuild=True; DeployTarget=MsDeployPublish; MSDeployPublishMethod=RemoteAgent; AllowUntrustedCertificated=True; MSDeployServiceUrl=http://localhost/MsDeployAgentService; DeployIisAppPath=Default Web Site/[my website]; UserName=[username]; Password=[password]"> /MSBuild>

What am I missing?

2
Everyone please be warned, when passing in Web Deploy Operation Settings, you cannot use '=' (equals). You have to use ':' (colon) e.g. -allowUntrusted=true MUST BE -allowUntrusted:true. I can't believe all of the doco uses = when it's plain wrong. It was shear luck that I figured this out. Official (incorrect) doco here: technet.microsoft.com/en-us/library/dd569089(v=ws.10).aspxVivian Farrell

2 Answers

3
votes

For IIS 7, check the following:

MSDeployPublishMethod=WMSVC 

MSDeployServiceUrl=localhost 

AllowUntrustedCertificate=True  -- Unless you have a valid certificate...

MSBuild Projects="[project file]" Properties="DeployOnBuild=True; DeployTarget=MsDeployPublish; CreatePackageOnPublish=True; MSDeployPublishMethod=**WMSVC**; MSDeployServiceUrl=**localhost**; DeployIisAppPath=Default Web Site/[my website]; UserName=[username]; Password=[password]; **AllowUntrustedCertificate=True**"> /MSBuild
2
votes

you could try some of these suggestions

1) MSBuild Add the flag -allowUntrusted (-allowUntrusted=True) to your msbuild command as the default wmsvc ssl cert is bonkers. try this first.

2) IIS > server node > Management Service Delegation. Have you set this up correctly? otherwise you need to set up rules for deploying stuff like contents, setting up applications, deploying databases and add users to those rules.

3) IIS > Sites > Default Website > IIS Manager Permissions Have you added your user to this list? If you do not have this option try running the web deployment tools installer again.

4) File/Folder permissions Have you set the correct permissions on your sites physical path directory?