1

I have a VS 2010 WCF service solution which I would like to deploy to IIS 7.5 servers via web deploy package. I would like to have the web deploy package generated when the WCF service project builds. I have seen other examples of how to initiate a web deploy packaging after build via importing MS Build targets for web deploy into the .csproj. But I cannot wrap my head around things which I am may or may not be able to to do this way.

I want my web deploy package to do the following tasks when deployed on a target server:

  • Create a new web site on the target server with an app pool to target framework 4.0 which uses NETWORK SERVICE identity
  • Add site bindings to enable net.tcp on a specific port and enable http and net.tcp prootocols
  • Create a web application under this new site to point to a specific file system folder
  • Run a .bat file to start couple of net.tcp related services to support non http WCF activation

From whatever I have read about web deploy, some of these can be done via webdeploy manifest files and including specific providers. What I am not understanding is telling the MS build packaging mechanism to pass the providers to include in the manifest and the values. I am fairly new to Web deploy and any help/pointers to solve this would be greatly appreciated.

quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107
siva
  • 169
  • 1
  • 1
  • 12

3 Answers3

1

The first three items can be done using the appHostConfig provider, which should be included if you set the IncludeIisSettings and UseIis properties both to true.

The last item can be done via the runCommand provider either as part of your manifest or via preSync / postSync.

WPP (the MSBuild stuff on top of MSDeploy) has no support for preSync / postSync, but you can include the runCommand provider explicitly using MsDeploySourceManifest:

<!-- Create a WebProjectName.wpp.targets file in the root 
     of your web application (WebProjectName)
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <AfterAddContentPathToSourceManifest>
      $(AfterAddContentPathToSourceManifest);
      AddPostSyncProviders
    </AfterAddContentPathToSourceManifest>
  </PropertyGroup>

  <Target Name="AddPostSyncProviders">
    <MsDeploySourceManifest Include="runCommand">
      <Path>absolute path to exe on target machine</Path>
    </MsDeploySourceManifest>
  </Target>
</Project>

FYI - runCommand can only execute absolute paths on the target machine as per this question.

Community
  • 1
  • 1
Richard Szalay
  • 83,269
  • 19
  • 178
  • 237
  • Appreciate your time on this and I like this idea. However, I would like to disagree on using _appHostConfig_ for creating the Website. I tried that already and MS Deploy always fails if the site does not already exists. – siva Sep 26 '12 at 21:56
  • The way how I worked around it was by keeping a separate .cmd file included in the project and copying them over to the package folder via xcopy on post build event. I have couple of appCmd commands in the above said .cmd file to set the application pool and site on the target server. I then launch the MS Deploy generated .cmd file from this batch file to kick start the MS Deploy process. I know this is ugly but it just works :(. – siva Sep 26 '12 at 21:57
  • I receive an error: The element beneath element is unrecognized. – Ezra Bailey Nov 19 '14 at 15:43
0

The approach I take is to use MSBuild to build the package and MSDeploy to deploy it to the server. I use the following command line, in my case I'm using cruise control:

/p:Configuration=Release 
/p:MSDeployPublishMethod=WMSVC 
/p:DeployOnBuild=True 
/p:DeployTarget=Package 
/p:CreatePackageOnPublish=True 
/p:DeployIisAppPath=$(SolutionName)/$(ProjectName) 
/p:MsDeployServiceUrl=https://<servername>:8172/MsDeploy.axd 
/p:AllowUntrustedCertificate=True 
/p:username=<username>
/p:password=<password>
/p:EnablePackageProcessLoggingAndAssert=True
/p:PackageLocation=$(WorkingMainDir)$(ProjectName)$(ProjectType)\Package\$(SolutionName).zip
/p:IntermediateOutputPath=$(WorkingMainDir)$(ProjectName)$(ProjectType)\Temp\
/p:AutoParameterizationWebConfigConnectionStrings=true
/p:UseWPP_CopyWebApplication=true

I then use msdeploy to deploy the resulting package, the following link (the accepted answer) is a good write up on how to do this:

msdeploy (Web Deploy) failing with 401 auth issues

Community
  • 1
  • 1
David Martin
  • 11,764
  • 1
  • 61
  • 74
-2

Tried that but project fails to load thereafter: The element < Path > beneath < MsDeploySourceManifest > is unrecognized.

Edmund
  • 1