Shown below is one of the most easiest way to configure a BizTalk Receive Location which can receive any WCF Message based on the Binding type you provide in the configuration. This uses the WCF Custom WebService Host Factory.
Where you can use this type of configurations?
· Scenario where you need to send a WCF Message from .NET Code.
· BizTalk Unit Testing.
· Receive Locations which will be using ESB Toolkit receive locations.
· and Many more.
Anyways, below are the steps:
- Create a IIS Virtual Directory and name it with some relevant name, say “Testing”. (Make sure the AppPool identity you select has proper priviledges.)
- Create a blank .svc file in the physical location of the directory, say “ReceiveMsg.svc”
- Open up that svc file in note pad and copy the below markup stuff in it.
<%@ ServiceHost Language="c#" Factory="Microsoft.BizTalk.Adapter.Wcf.Runtime.CustomWebServiceHostFactory, Microsoft.BizTalk.Adapter.Wcf.Runtime, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
- Next, open up BizTalk Admin Console and Create a Receive Port in whichever BizTalk App where you want the port to be.
- Create a Receive Location for that Receive Port.
- Select the Transport Type as WCF-CustomIsolated.
- Next configure the WCF-CustomIsolated type. For the URI type "/Testing/ReceiveMsg.svc".
- For the binding you can select any WCF binding, here for the example I choose basicHTTPBinding. You can also configure the security configuration for this binding but lets leave it default for the example. Make sure you configure your client which sends the message according to same binding configurations.
- Pipeline: You can have your own Custom Pipeline or use BizTalk default ones. Here, lets keep it PassThruReceive.
- That’s it. Your receive location is configured and now just enable it.Next go to IIS and browse the ReceiveMsg.svc. You should see the below screenshot.
There are bunch of blog posts where it shows how you can send message to Biztalk though custom .net code. You can refer my previous blog post in which I have shown how you can use netNamedPipeBinding. One of my collegue Uri Katsir has blog post where he shows about WSHttpBinding.