In more advanced WCF scenarios, the BizTalk standard functionality can be insufficient. In those cases, WCF extensibility can help us to overcome the limitations of the standard BizTalk WCF adapters. Typical examples are custom MessageInspectors, ErrorHandlers, Decoders and AuthorizationBehaviors.
Once you have registered the extensibility, you can configure it on the WCF-Custom or WCF-CustomIsolated receive and send ports:
When the WCF send or receive port is executed, your WCF extensibility objects will be injected into the WCF channel stack.
But how can we register these WCF extensions?
BizTalk 2006 R2 and BizTalk 2010
In the previous versions of BizTalk, there was only one way to register WCF extensions: the machine.config.
– The C:WindowsMicrosoft.NETFrameworkv2.0.50727CONFIGmachine.config is needed for 32-bit processes:
- BizTalk 32-bit host instances
- IIS 32-bit applications
- BizTalk Administration Console
– The C:WindowsMicrosoft.NETFramework64v2.0.50727CONFIGmachine.config is needed for 64-bit processes
- BizTalk 64-bit host instances
- IIS 64-bit applications
BizTalk 2010: The new feature
BizTalk Server 2010 comes with a nice new feature for registering your WCF extensibility assemblies. The new feature allows you to avoid the machine.config and to register them in BizTalk itself. Let’s have a look!
- Browse to the WCF-Custom adapter handlers.
- Open the receive or send handler. Choose Properties.
- Here you can import a web.config / app.config that contains your WCF extensions.
BizTalk 2010: The caveat
Unfortunately, this doesn’t work if your receive port is hosted in IIS. You can register the WCF extensions on the WCF-CustomIsolated adapter handlers. However, when the WCF-CustomIsolated receive port is called, you get an activation error:
“WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/45653674
Exception: System.ServiceModel.ServiceActivationException: The service ‘/ApplicationName/Service.svc’ cannot be activated due to an exception during compilation. The exception message is: Unable to create endpoint behavior configuration element from XML configuration.
Check the following:
1. Verify behavior element extensions in machine.config are correctly configured.
2. Restart the application if machine.config was recently updated.
3. Ensure the configuration is valid XML that conforms to the configuration schema.”
Adding the WCF extensions in the corresponding web.config of IIS also doesn’t solve this issue. The only solution I’ve found is to register them again in the machine.config. Remember that BizTalk 2010 is .NET 4.0.
– The C:WindowsMicrosoft.NETFrameworkv4.0.30319CONFIGmachine.config is needed for 32-bit processes:
- BizTalk 32-bit host instances
- IIS 32-bit applications
- BizTalk Administration Console
– The C:WindowsMicrosoft.NETFramework64v4.0.30319CONFIGmachine.config is needed for 64-bit processes
- BizTalk 64-bit host instances
- IIS 64-bit applications
Conclusion
- Only when using the WCF-Custom adapter in BizTalk 2010, you can register WCF extensions in BizTalk itself.
- In all other scenarios, you need to register them in the corresponding machine.config. This has the drawback that this also influences other applications on the server.
Subscribe to our RSS feed