Publishing and using a Biztalk Scema using the WCF-WSHttp adapter
This morning I had to expose a Biztalk Schema using the BizTalk WCF Service Publishing Wizard, this wizard is pretty straightforward and I will not discuss how to use this wizard. Well after I generated my WCF service the fun started. This blog entry will describe the issues I encountered and how I resolved them.
Attempt 1 : Accessing the WCF generated service
So I just generetared a WCF service, and when I tried to access it I ran into the following issue: "The Messaging Engine failed to register the adapter for "WCF-WSHttp" for the receive location "/BizTalkWcfService/svcManager.svc". Please verify that the receive location exists, and that the isolated adapter runs under an account that has access to the BizTalk databases."
The error as described above is pretty clear and more or less it comes down to the fact that the service account which the application pool of the website uses no rights has to access the Biztalk Resources (databases). In order to resolve this issue I defined a new application pool in IIS, and ensured that it would run using a security account with sufficient rights to access the Biztalk resources . Below I wrote down the steps I performed to resolve this issue
Define an application pool with sufficient rights to use the Biztalk resources
1. Open up the IIS Manager and expland the Application Pools folder.
2. Right-click and select new -> Application pool

3. A popup appears, now give the to created application pool a unique name (ID) and use the default settings for the new application pool and press OK

4. A new application pool has been created, now open it again by selecting the appliction pool (right-click -> properties).
5. Within the Properties screen go to the identity tab, check the configurable option and select an user-account which has the appropriate rights

6. Once done, press OK and now go to the website (or virtual directory) which will host the WCF service and select its properties and select the 'Directory' tab.
7. Within the properties screen, change the application pool so that it will use the earlier defined application pool (stel 5)

8. Press OK and now your application will be running in an application pool which has sufficient rights to access the Biztalk resources.
Attempt 2 : Accessing the WCF generated service
So I fixed the application pool issue, but when I tried to access the WCF service I ran into the following issue: "This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. Parameter name: item.".
Ah yippy I thought and started up a new browser session and decided to Bing this issue, and behold I ended up reading a the following blog entry "Words of wisdow from the Elder", with the solution, in short the error as described above occurs whenever you have multiple identities using the same website (for example; application A om port 80 and application B op port 8080, both using localhost / 127.0.0.1). Below a bried summary which explains who to fix this error
Hosts File and baseAddressPrefixFilters
1. Add a line to your windows\system32\drivers\etc\hosts file, which results in being able to resolve to your own machine other then 127.0.0.1 or localhost.

2. Once you added the enty save the file and open up the commandline and try to ping your machine, using the name you just added in the hosts file (in my case I used; biztalkPOC)

3. You should have been able to ping yourself. Now it is time to ensure that your wcf service can be accessed locally using this newly created hostname. In order to do this we will have to open up the IIS Manager, select the website which hosts the WCF service and assign the new host name. You do this by selecting the website properties (right-click) and click on the advanced button which can be found on the Web Site tab.

4. A screen called 'Advanced Web Site Identification' will pop up and the first thing you should notice that there will be mulitple entries and none of these entries have a host header value assigned.

5. Select that entry with is used by your WCF service (in my case the WCF service is listening on port 80), click on the edit button and assign a host header value and for this you will use the name you used in step 1 (in my case; biztalkPOC)

6. Click Ok and now open up the web.config file of your wcf service.
7. Add the following entry within the <system.serviceModel> element (Please ensure you have .net 3.5 framework installed!)
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://biztalkPOC/<path to your wcf service>"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>

8. Save the webconfig. Go back to the IIS Manager, select your application pool and recycle it.
Attempt 3 : Accessing the WCF generated service
Well after fixing the app-pool thingy and the hosts file thingy it was about time to give it another go, and yes this time everything was working!

Today's lesson learned
Using a wizard is easy, but usually you will have to do some magic yourself in order for it all to work.
58876dc1-0b5e-4ce9-868f-df9026889fad|0|.0