Monday, November 26, 2012

Exposing BizTalk Service metadata using NetTCP in IIS

Usually the BizTalk WCF Service Publishing Wizard can expose the metadata using on HTTP Transport. Is it possible to expose in other transport mechanism? The question came to my mind, when I got an opportunity to solve a problem for one of the BizTalk Team facing for quite few days.
 
The requirement is to publish the BizTalk WCF Service metadata in IIS i.e. the actual Service should be hosted in the BizTalk and the Metadata (Address, Binding, and Contract) should be hosted in IIS. The Critical point is both have to be in the same TCP Transport protocol.
 
First, the below blog will give you step by step approach to publish the schema as service from the BizTalk application using “BizTalk WCF Service Publishing Wizard”
 
But now the problem is service and metadata endpoint are in different transport
Metadata endpoint: http://:/> (This service will be hosted by the IIS)
Service endpoint : net.tcp://:/ (This service will be hosted by the BizTalk)
After a day of analyzing various factor, I arrived the following steps to resolve the issue.
 
Step 01: Configure the receive location as mentioned in the blog
Step 02: Publish the metadata as usual BizTalk WCF Service Publishing Wizard
Step 03: In IIS (This is the changes what we have to do)
01.   Right click on the application -> Manage Application -> Advance Settings. Set the Enabled Protocol as “http,net.tcp” (Update by adding the net.tcp)
02.   Web.Config changes.
a.   Add the below configuration in the <system.serviceModel>. This will work only in .Net 4.0. Previous version does not have the capability to hold multiple binding
   <serviceHostingEnvironment >
        <baseAddressPrefixFilters>
              <addprefix="net.tcp://localhost:808"/> (check the port in the binding of the website. The port has to be same)
           </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
b.      Add the new metadata endpoint as below
  <endpointname="mexTcpBinding"address="net.tcp://:/WcfServiceOneWay/Service1.svc"binding="mexTcpBinding"bindingConfiguration=""contract="IMetadataExchange" />
 
Address :  Provide the full path of the metadata service URI.alternative you can set the base address in the config
 
Now both the service and metadata endpoint are on the same transport
Service endpoint:  net.tcp:// :/(Hosted by BizTalk)
Metadata endpoint: net.tcp:// :/(Hosted by IIS)

No comments:

Post a Comment