Recently I was in Redmond for the BizTalk VTS Summit, with a bunch of colleague BizTalk experts from all over the world. During one of the discussions we had, a question came up about the fact that it seemed that to host HTTP endpoints, it is required to have IIS as the real host configured.
After my suggestion that is was perfectly possible to bypass IIS in this process, it looked that quite a number of attendees didn’t know about this. And that’s the reason why I decided to add it to our blog
WCF-Custom vs WCF-CustomIsolated
First of all, I think it is a best practice to avoid using the non-WCF-custom adapters (like WCF-WSHttp, etc). I always suggest colleagues and customers to use the WCF-Custom or WCF-CustomIsolated adapter, since they are the only adapters that provide the maximum capabilities of WCF in BizTalk. The other WCF-* adapters only provide a subset of the various binding and behavior settings, specific for their binding, which results in an adapter change, when a more advanced setting is needed one day.
The WCF-Custom adapter, is the adapter that is used to host WCF endpoints inside BizTalk. The WCF-Isolated adapter is hosted in a BizTalk Isolated Host, which is typically IIS.
The BizTalk WCF Service Publishing wizard
To expose an orchestration or a schema as a WCF service in BizTalk, the BizTalk WCF Service Publishing wizard is the typical way to use. In this wizard, the orchestration or schema needs to be selected and a choice between three adapters is possible: WCF-BasicHttp, WCF-WSHttp, WCF-CustomIsolated.
The last step of the wizard is used to create a web directory in IIS, where the BizTalk svc file will be created that hosts the custom WCF Service Host that will link through to the BizTalk Receive location.
Unfortunately, the WCF Publishing wizard does not allow to select the ’In-Process’ adapters. All of the three adapters/bindings are only available through an isolated host and required IIS.
Hosting the endpoint in the BizTalk process
To host the endpoint inside the BizTalk process, we need to manually create the WCF receive location. To do so, we just need to select the WCF-Custom adapter and use the desired binding: BasicHttpBinding or WsHttpBinding.
The following steps need to be used for this:
- Create a new receive location with the desired name
- Select the WCF-Custom adapter and open the properties for this adapter
- Specify an address for the endpoint (picture 1) Take into account that when IIS is already running on the machine, you might need to specify a different available port.
- Select your binding (or use the customBinding for full flexibility) in the Binding tab page. (picture 2) and set all desired binding properties to their correct setting.
- In the Messages tab page, you can also specify that failed request messages need to be suspended and that exceptions should be returned to the consumer. (picture 3)
Metadata publication
One downside of this way of work is the metadata publishing. If you would query the exposed endpoint for the WSDL, you would get to see the WSDL of the generic BizTalk WCF Service Host with the 5 operations.
Therefore, it is needed to publish the metadata endpoint to IIS and provide that endpoint to the consumers of your in-process service. But this way of work, is similar to the other protocols (like netMsmq, netTcp)
Advantages
- Consistent approach for all binding types, independent of protocol.
- No extra configuration / deployment needed (specific IIS security on IIS application pools, etc)
- Performance (no extra hop)
Sam Vanhoutte, CODit