Switching a Published WCF Service between WSHttp and BasicHttp

When using the BizTalk WCF Service Publishing Wizard to create WCF services a number of files and directories are created in the stipulated virtual directory folder.  The directory structure created is shown below, with a brief statement as to what is in each directory:

  • Root Directory: contains the .svc files for each service that has been published, and the web.config file. 
    • The App_Data directory contains the schemas for those services that have been published.
      • The Temp sub-directory contains the binding file for the services and the WcfServiceDescription.xml file, which contains the various properties entered into the WCF Publishing Wizard.

At a customer recently there was a requirement to take these published services and change them from using the WCF-WSHttp adapter to using the WCF-BasicHttp adapter.  One option was to republish the WCF services, but this was quickly discarded as there were a large number of services.  As BizTalk does not include a command line version of the WCF Publishing Wizard in the installation the customer was in the process of developing their own WCF publishing service, using the WcfServiceDescription.xml file located in the Temp directory.  After pointing out to them the availability of an existing command line utility, as docmented at https://technet.microsoft.com/en-us/library/bb245933.aspx, they decided to use this instead.  Using the command line tool, and by setting the "AdapterName" argument to "WCF-BasicHttp", they were able to very quickly then republish their endpoints and change all their receive locations to use the WCF-BasicHttp adapter.

There are a few things to be aware of when using this command-line utility, however:

  1. The first argument for the utility is "PathName", which is required to be the "Path and file name of the BizTalk assembly (*.dll) or the WCF service description (*.xml) file".  If you are using the utility to publish an orchestration then the path to the BizTalk assembly can be used, but if you are publishing schemas using the path to the BizTalk assembly will result in the utility completing successfully, but there will be no .svc files in the root of the directory, and there will be no schema files in the App_Data directory.  When publishing a schema as a WCF end-point you will need to use the path to the WCF service description file, which is the WcfServiceDescription.xml file found in the Temp directory of a published WCF end-point.
  2. As the utility overwrites the contents of the virtual directory, when the -Overwrite argument is used, any changes you made to the web.config file will be lost.  So, don't forget to add the <trust level="Full" /> text just before the </system.web> text in the web.config file after the utility has completed its execution.

This tool is available for download from: https://go.microsoft.com/fwlink/?LinkId=92955, and the documentation for it is located at: https://technet.microsoft.com/en-us/library/bb245933.aspx.