Install and Configure Components
The next step is to install and configure the components needed to use the WCF extensions. This topic lists these steps.
Install and Configure Components
To use the WCF extensions in a BizTalk application, do the following:
Install the solution assemblies in the global assembly cache (GAC).
Using the gacutil tool, you can automatically install your assembly to the GAC whenever you build the class library. To do this, include the execution of the gacutil tool in the post-build event command-line of the project, as shown in following image:
To verify that the assembly is successfully installed in the GAC, execute the following command:
gacutil /lr <assemblyName>Register the components in the proper machine.config file on the BizTalk Server computer using one of the following methods:
Register all the components in the system.serviceModel section in the machine.config.
Register all the components in the system.serviceModel section in the BTSNTSvc(64).exe.config.
Configure the components as WCF Extensions in the configuration of the Send and Receive Handlers of the WCF-Custom adapter, as shown in the following image:
Configure part of the WCF extensions in one place and your component in another. For example, configure the WCF extensions of the Microsoft.ServiceBus at the WCF-Custom adapter level. Configure your components in the machine.config.
Whichever method you choose, you can use the WCFServiceBusExtensions.config and WCFSolutionExtensions.config files in the Setup folder to register the WCF extensions introduced by the Service Bus and those defined in this solution. Or, use the WCFServiceBusAndSolutionExtensions.config file to configure them altogether.
WCFServiceBusExtensions.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <extensions> <behaviorExtensions> <add name="connectionStatusBehavior" type="Microsoft.ServiceBus.Configuration.ConnectionStatusElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="transportClientEndpointBehavior" type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="serviceRegistrySettings" type="Microsoft.ServiceBus.Configuration.ServiceRegistrySettingsElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </behaviorExtensions> <bindingElementExtensions> <add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="tcpRelayTransport" type="Microsoft.ServiceBus.Configuration.TcpRelayTransportElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="httpRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpRelayTransportElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="httpsRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpsRelayTransportElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="onewayRelayTransport" type="Microsoft.ServiceBus.Configuration.RelayedOnewayTransportElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </bindingElementExtensions> <bindingExtensions> <add name="basicHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.BasicHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="webHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WebHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="ws2007HttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WS2007HttpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="netTcpRelayBinding" type="Microsoft.ServiceBus.Configuration.NetTcpRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="netOnewayRelayBinding" type="Microsoft.ServiceBus.Configuration.NetOnewayRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="netEventRelayBinding" type="Microsoft.ServiceBus.Configuration.NetEventRelayBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> <add name="netMessagingBinding" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </bindingExtensions> </extensions> <client> <endpoint address="" binding="netTcpRelayBinding" contract="IMetadataExchange" name="sb"/> </client> </system.serviceModel> </configuration>
WCFSolutionExtensions.config
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <extensions> <behaviorExtensions> <add name="bizTalkMessageInspector" type="Microsoft.WindowsAzure.CAT.Samples.ServiceBusForWindowsServer.MessageInspector.ServiceBusMessageInspectorBehaviorExtensionElement, Microsoft.WindowsAzure.CAT.Samples.ServiceBusForWindowsServer.MessageInspector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=197ec3eb961f773c"/> <add name="bizTalkListenUri" type="Microsoft.WindowsAzure.CAT.Samples.ServiceBusForWindowsServer.ListenUri.ListenUriBehaviorExtensionElement, Microsoft.WindowsAzure.CAT.Samples.ServiceBusForWindowsServer.ListenUri, Version=1.0.0.0, Culture=neutral, PublicKeyToken=197ec3eb961f773c"/> <add name="bizTalkSessionChannel" type="Microsoft.WindowsAzure.CAT.Samples.ServiceBusForWindowsServer.SessionChannel.SessionChannelBehaviorExtensionElement, Microsoft.WindowsAzure.CAT.Samples.ServiceBusForWindowsServer.SessionChannel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=197ec3eb961f773c"/> <add name="bizTalkSecurity" type="Microsoft.WindowsAzure.CAT.Samples.ServiceBusForWindowsServer.Security.TokenProviderBehaviorExtensionElement, Microsoft.WindowsAzure.CAT.Samples.ServiceBusForWindowsServer.Security, Version=1.0.0.0, Culture=neutral, PublicKeyToken=197ec3eb961f773c"/> </behaviorExtensions> </extensions> </system.serviceModel> </configuration>
Configure BizTalk Server to use the correct version of the Microsoft.ServiceBus.dll. To configure BizTalk Server to use Microsoft.ServiceBus.dll v1.8, do the following:
BizTalk Server 2010: Register the component in the GAC or copy the assembly into the BizTalk installation folder.
BizTalk Server 2013 Beta: BizTalk Server 2013 Beta and the SB-Messaging adapter use Microsoft.ServiceBus.dll v1.7. To use Microsoft.ServiceBus.dll v1.8, use Assembly Binding Redirection to replace v1.7 by adding the following section to the machine.config:
AssemblyBindingRedirect.xml
<?xml version="1.0" encoding="utf-8"?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.ServiceBus" publicKeyToken="31bf3856ad364e35" culture="Neutral" /> <bindingRedirect oldVersion="1.7.0.0" newVersion="1.8.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
This XML snippet is also available in the AssemblyBindingRedirect.xml file in the Setup folder.
Next Step
See Also
Concepts
Environment Setup
Create the WCF Contracts
Create the Endpoint Behaviors
Install and Configure Components
Create the BizTalk artifacts
Invoke the application
Test the Solution
Solution Conclusion