Scripting Deployment of WCF Services using BtsWcfServicePublishing

BizTalk makes deploying WCF and ASMX services easy using the BizTalk Web Service Deployment wizard, but it can be tedious and time consuming deploying new versions whilst developing new services where the schemas can often change and need to be refreshed. Fortunately the task can be scripted using the BtsWcfServicePublishing.exe tool downloadable from Microsoft which picks up the values from a predefined XML file. This tutorial talks you through the steps you need to take to do this.

Go through the BizTalk WCF deploykment wizard in the normal way. Just before the end of the wizard some XML appears which you can use to automate future deployments. Highlight this text, copy to the clipboard using ctrl-c and paste into a new .xml file in a text editor of your choice before saving to disk. Then publish your service using the wizard.

A slight quirk of the tool (at least on my server deployment) is that I need to change <?xml version=”1.0″ encoding=”utf-16″?> to just <?xml version=”1.0″> at the top of the file. I don’t really know why.

Then whenever your schema or other service properties change at all, deploy the new schema to BizTalk in the usual way from Visual Studio and then run the BtsWcfServicePublishing.exe tool from the command prompt with one parameter, the path to your saved XML file. e.g.

"D:\Temp\BtsWcfServicePublishing.exe" "D:\Temp\myexportedwcfconfig.xml"

You can alter any of the peroperties in the XML file, most are self explanatory. Some of the more useful ones are:

  • CreateReceiveLocations=”false”. If you are just going to refresh the schema you probably want to set this to false otherwise all of your receive properties you have configured will get wiped out.
  • Location=”http://localhost/MyService“. You might want to change this to another location so that you have different authentication methods for example. For example when I am developing certificate based services I find it very useful to have a service with all authentication disabled so I can use test tools such as SoapUI.
  • Overwrite=”true”. Probably always want this to be true otherwise the process will fail.
  • AuthAnonymous=”true”. Probably always want this to be true as authentication is usually managed on the BizTalk side rather than IIS.

You can also hand craft the XML to add new Operations and Services which is very useful when the scope of your service operations expand as you don’t have to reconfigure all of the existing services by selecting schemas and the like in the Wizard.

I would also recommend adding the XML configuration to your Visual Studio BizTalk project and keeping it under source control so that other developers can also take advantage of this.

  1. Hi frostystoo, and thanks for the post. I haven’t been able to add new operations by editing the xml, have you had any luck with it?

Reply to frostystoo ¬
Cancel reply

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>