April 30, 2013 at 4:30 PM

On the latest version of BizTalk (2013): a new adapter was introduced for natively working with REST endpoints, using WCF technology: the WCF-WebHttp Adapter. 

After the beta version was released we could find some very good articles about this adapter, but since it is a new adapter there's a lot of ground to cover.
At the moment of my writing, the  MSDN website has very few information about it, so time to give something to the community... 

 


On this small article I will focus on using HTTP headers with the new adapter.

In this scenario I wanted to set HTTP content type at the header level. This could be done in two ways: using the adapter properties or writing in the message context. 

 

Adapter properties 

Using the adapter properties is a fairly simple task, we just need to go to our port properties and then adapter properties. On the last tab "Messages" we have a text area destined to Outbound HTTP Headers. Every HTTP header that we place here will be included on the message that will be sent (I'm using a send port for this example).

 

 

By default, WCF-WebHttp sends your message with as "Content-Type: application/xml; charset=utf-8", if you want to invoke a REST service with a GET request, for instance, you will have to insert the following code in the HTTP Outbound Headers:

Content-Type: application/http

And use a PassThruTransmit pipeline component, or another component that doesn't validate XML.


Message Context

If we need to set the HTTP headers at runtime we could do this mainly on orchestrations or pipeline components by writing the property on context.

 

We have two properties available to set in the headers: 

Property Name

Property Schema

Adapter

UserHttpHeaders

http://schemas.microsoft.com/BizTalk/2003/http-properties

HTTP

OutboundCustomHeaders

http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties

WCF-*


Both options will not raise any error if you try to write/promote them, but it won't work!
UserHttpHeaders is for HTTP adapter only, if you use it you will send the message as application/xml since the property isn't read by the adapter and since we are assuming that there is no HTTP header configured on the adapter properties.
The same goes for the OutboundCustomHeaders, it's for SOAP messages only (and using an XML structure), if you try to use it you will have the following error:
 

System.InvalidOperationException: Envelope Version 'EnvelopeNone (http://schemas.microsoft.com/ws/2005/05/envelope/none)' does not support adding Message Headers. 

If you happen to have an XML error it's probably because OutboundCustomHeaders is expecting an XML structure and you are not passing one.

 

So after dwelling on this issue for some time I inspected the new Biztalk 2013 property schema for WCF, and we can clearly  see some new properties related to the WCF-WebHttp adapter: 
 

Name

Type

Description

InboundHttpHeaders

xs:string

The HTTP headers present in the inbound message received over a HTTP transport

InboundHttpStatusCode

xs:string

The HTTP status code of the response message

InboundHttpStatusDescription

xs:string

The HTTP status description of the response message

InboundHttpMethod

xs:string

The HTTP Verb of the request message

OutboundHttpStatusCode

xs:string

The HTTP status code of the response message

OutboundHttpStatusDescription

xs:string

The HTTP status description of the response message

SuppressMessageBodyForHttpVerbs

xs:string

Removes the Message Body from the outbound request message, for the specified HTTP Verbs

HttpHeaders

xs:string

Sets HTTP headers for the outbound message

VariablePropertyMapping

xs:string

Provides the URL Template Variables and Message Context Properties mapping configuration

HttpMethodAndUrl

xs:string

Provides the HTTP Method and URL mapping configuration

 

In my scenario I wanted to use a send port, so the property that suits my purpose was HttpHeaders
All I had to do was write the content type into the property, without the need of promoting it. 

Here's part of my Execute() method of the custom pipeline component, where I set the message content type to application/atom+xml.


public Microsoft.BizTalk.Message.Interop.IBaseMessage Execute(IPipelineContext pContext, Microsoft.BizTalk.Message.Interop.IBaseMessage pInMsg)
{
    // Some non important logic here

    pInMsg.Context.Write("HttpHeaders", "http://schemas.microsoft.com/BizTalk/2006/01/Adapters/WCF-properties","content-type: application/atom+xml");

    return pInMsg;
}


Another important note that I should add, is about the adapter HTTP header limitations:
If you are planning to change the HttpHeader per message it won't work with a standard port, since by "design" the adapter uses the properties by port and not by message. If you need to change the header at runtime (per message) you will need to use a dynamic port instead.


And that’s it Smile

Ricardo Marques

 

 

 

Posted in: BizTalk | REST | WCF

Tags: , ,


March 6, 2013 at 4:05 PM

In many scenarios, it could be required to have a send port with a dynamic behavior:

  • Send messages to a FILE location, containing the date of today
  • Send a notification mail to many different recipients
  • Dynamically change the URL of the backend web service, depending on the incoming request

 

Many developers would solve this by using dynamic send ports.  These ports allow you to configure all adapter properties, even the adapter type, at runtime.  I’m not a big fan of dynamic send ports, because it introduces some drawbacks:

  • Dynamic send ports are very difficult to troubleshoot (a hell for your operations team)
  • Dynamic send ports require your port configuration to be stored in a secure way (custom SSO application)
  • Dynamic send ports have a bigger performance hit (solved in BTS 2013)
  • Dynamic send ports don’t allow to specify an adapter handler (solved in BTS 2013)

 

That’s why I prefer using static send ports.  With a very easy trick, you can make static send ports partially dynamic.  Mostly it’s only the connectionstring, URI, path that must be changed at runtime.  This can be achieved in a custom pipeline component in the send pipeline:

 

 

This dynamic behavior works smooth for FILE and FTP adapters.  However, when using this mechanism on WCF send ports, there’s a caveat.  You will find out that the BTS.OutboundTransportLocation of the first message will be cached on the WCF send port.  So all subsequent messages will be sent to the same location.  This port configuration is cached until your send port configuration is modified or until your adapter send handler is restarted.  Luckily: there’s a way to disable this caching:

 

 

By setting the BTS.IsDynamicSend property to true, you force the WCF send adapter not to use the cache, but the runtime value instead.  More information on this setting can be found on MSDN.

Posted in: BizTalk | General | WCF

Tags: ,


January 28, 2013 at 2:41 PM

The BizTalk Server 2013 Beta release comes with the SB-Messaging adapter.  This adapter allows our on-premise BizTalk environment to integrate seamlessly with the Windows Azure Service Bus queues, topics and subscriptions.  Together with my colleague Mathieu, I had a look at these new capabilities.

 

Adapter Configuration

The configuration of SB-Messaging receive and send ports is really straightforward.  BizTalk just needs these properties in order to establish a connection to the Azure cloud:

  • Service Bus URL of the queue, topic or subscription:

        sb://<namespace>.servicebus.windows.net/<queue_name>

  • Access Control Service STS URI:

        https://<namespace>-sb.accesscontrol.windows.net/

  • Issuer name and key for the Service Bus Namespace

 

Content Based Routing

Both Service Bus and BizTalk messaging layer offer a publish-subscribe engine, which allows for content based routing.  In BizTalk, content based routing is done through context properties, the Azure Service Bus uses Brokered Message properties.  A BizTalk context property is a combination of the propertyName and propertyNamespace.  In Azure Service Bus, context properties are only defined by a propertyName.  How are these metadata properties passed from the cloud to BizTalk and vice versa?

 

Sending from BizTalk to Service Bus topic

In order to pass context properties to the Service Bus topic, there’s the capability to provide the Namespace for the user defined Brokered Message Properties.  The SB-Messaging send adapter will add all BizTalk context properties from this propertyNamespace as properties to the Brokered Message.  Thereby, white space is ignored.

image

 

Receiving from Service Bus subscription to BizTalk

Also at the receive adapter, there’s the possibility to pass properties to the BizTalk message context.  You can specify the Namespace for Brokered Message Properties, so the SB-Messaging adapter will write (not promote) all Brokered Message properties to the BizTalk message context, within the specified propertyNamespace.  Be aware when checking the option Promote Brokered Message Properties, because this requires that a propertySchema is deployed which contains all Brokered Message properties.

 

image

 

Receive Port Message Handling

I was interested in the error handling when an error occurs in the receive adapter or pipeline.  Will the message be roll backed to the Azure subscription or suspended in BizTalk?  Two fault scenarios were investigated.

 

Receive adapter unable to promote property in BizTalk context

In this case, we configured the receive port to promote the context properties to a propertyNamespace that did not contain all properties of the Brokered Message.  As expected, the BizTalk adapter threw an exception:

  • The adapter "SB-Messaging" raised an error message. Details "System.Exception: Loading property information list by namespace failed or property not found in the list. Verify that the schema is deployed properly.

The adapter retried 10 times in total and moved afterwards the Brokered Message to the dead letter queue of the Service Bus subscription.  Afterwards, BizTalk started processing the next message.

 

Receive pipeline unable to parse message body

In this simulation we tried to receive an invalid XML message with the XMLReceive pipeline.  After the error occurred, we discovered that the message was suspended (persisted) in BizTalk.

 

WCF-Adapter Framework

It’s a pity to see that this new adapter is not implemented as a WCF-binding.  Due to this limitation, we can’t make use of the great extensibility capabilities of the WCF-Custom adapter.  The NetMessagingBinding could be used, but I assume some extensibility will be required in order to transform BizTalk context properties into BrokeredMessageProperty objects and vice versa.  Worthwhile investigating…

 

Conclusion

The BizTalk product team did a great job with the introduction of the SB-Messaging adapter!  It creates a lot of new opportunities for hybrid applications.

Posted in: Azure | BizTalk | Service Bus | WCF

Tags:


December 14, 2012 at 2:23 PM

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:

 

      image

 

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:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config is needed for 32-bit processes:

  • BizTalk 32-bit host instances
  • IIS 32-bit applications
  • BizTalk Administration Console

 

-   The C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config is needed for 64-bit processes

  • BizTalk 64-bit host instances
  • IIS 64-bit applications

 

        image

 

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.

 

        image

 

  • Open the receive or send handler.  Choose Properties.

 

        image

 

  • Here you can import a web.config / app.config that contains your WCF extensions.

         

       image

 

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:\Windows\Microsoft.NET\Framework\v4.0.30319\CONFIG\machine.config is needed for 32-bit processes:

  • BizTalk 32-bit host instances
  • IIS 32-bit applications
  • BizTalk Administration Console

 

- The C:\Windows\Microsoft.NET\Framework64\v4.0.30319\CONFIG\machine.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.

 

Please get in touch if you managed to get this working!

Posted in: BizTalk | WCF

Tags:


October 24, 2012 at 4:19 PM

For a recent project I needed to send messages to BizTalk through an ASP.NET application.
The purpose of the ASP.NET website was to provide a simple user interface to send messages to BizTalk, where people can download / upload messages (with validation).

The users can first validate their message, this is done through a BizTalk pipeline that parses the message and does several checks to see if it is valid.

I exposed a request-response receive location using net named pipe binding that executes the validation.
The BizTalk pipelines parses the message and converts it to a “Validator Message” that contains the errors / warnings of the message.

Some of the files that are uploaded are pretty huge ( > 100 mb as a flatfile).
That is one of the reasons why I opted for the net.pipe binding, because this binding can implement streaming (note: not all bindings can implement streaming mode!).
Another reason why I opted for that binding is because this binding is perfect for communication between WCF applications on the same machine.

BizTalk

Here is how I set-up the BizTalk side.

I created one request-response receive port and added a receive location. I route the message I receive from the receive pipeline directly back to the send pipeline of that port, so I don’t need additional send ports.
You can see how to do this in another blogpost
The receive location uses the WCF-Custom adapter with the netnamedBinding.

I changed some default values, like the maxReceivedMessageSize, and made sure that “transferMode” is set to “Streamed”.

image

I also needed to change some settings in the “Messages” section.
I had to change the inbound and outbound message body, this is dependent on how you name the WCF interface in your .NET application (see section “.NET application” below).

Inbound Message Body

Extract the stream by selecting the xpath, in my case the xpath looks like following:

/*[local-name()='SubmitMessage' and namespace-uri()='http://App.services/BizTalk']/*[local-name()='Message' and namespace-uri()='http://App.services/BizTalk']

Also make sure that you set the Node Encoding to “Base64”, since we are sending a stream.

Outbound Message body

You also need the “wrap” the stream we receive back, so it is a valid response message according the interface of the WCF service we setup in the .NET application.

You can do this by setting the template. In my case I had to set it like following:

<ns0:SubmitMessageResponse xmlns:ns0="http://App.services/BizTalk">     
     <ns0:SubmitMessageResult xmlns:ns0="http://App.services/BizTalk">         
          <bts-msg-body xmlns="http://www.microsoft.com/schemas/bts2007" encoding="base64"/>     
     </ns0:SubmitMessageResult> 
</ns0:SubmitMessageResponse>

Be sure to include the “encoding” parameter so it encodes the message as base64.

image

Only thing left to do is set the uri of the receive location, example:  net.pipe://localhost/App/ValidatePricat

.NET Application

First thing to do is create the WCF interface.

I implemented the “IClientChannel” so I could use an OperationContextScope in my client to add a custom WCF header.

[ServiceContract(Namespace = "http://App.services/BizTalk")]
public interface IBizTalkSubmitService : IClientChannel {         
   [OperationContract(Action = "*", ReplyAction = "*")]         
   Stream SubmitMessage(Stream Message);  
}

 

Now for sending the stream to BizTalk.

FIrst create a channelfactory of the interface above, using the correct binding.
Make sure you set the transferMode to “Streamed”.

NetNamedPipeBinding b = new NetNamedPipeBinding("NetNamedPipeBinding_BizTalkService"); 
EndpointAddress epa = new EndpointAddress("net.pipe://localhost/App/" + operation); 
var myChannelFactory = new ChannelFactory<IBizTalkSubmitService>(b, epa);

Next create the client. You will see I am using an OperationContextScope. This is for adding a custom WCF header.
The reason why I need to add a custom WCF header is because the site is multilingual, so I implemented multiple languages in the BizTalk solution for returning error / warning messages concerning the validity of the message in the correct language.

You will see following line of code:

header.GetUntypedHeader("PropertyContainer", "https://R4A.Properties");

BizTalk will automatically promote the messageheader in the context. For this to work, you will need to create (and deploy) a propertyschema containing the property “PropertyContainer” (the one you defined in the above line of code) in the correct namespace.
The value of the “propertycontainer” is an XML document that has been encoded (but this could also be a simple string), I did this because I have multiple properties (language, some codes for validation, ..) and this way I can easily extract it in a custom pipelinecomponent in BizTalk.

This is the full code:

public Stream SendMessage(string operation, Dictionary<string, string> contextProperties, Stream message)        
{            
     NetNamedPipeBinding b = new NetNamedPipeBinding("NetNamedPipeBinding_BizTalkService");            
     EndpointAddress epa = new EndpointAddress("net.pipe://localhost/App/" + operation);           
     var myChannelFactory = new ChannelFactory<IBizTalkSubmitService>(b, epa);           
     
     IBizTalkSubmitService client = null;            
     Stream response = null; 
           
     try
     {                 
          client = myChannelFactory.CreateChannel();                
          using (OperationContextScope contextScope = new OperationContextScope(client))                 
          {                     
               if (contextProperties != null)                     
               {                         
                    XmlDocument xDoc = new XmlDocument();                         
                    XmlElement rootNode = xDoc.CreateElement("PropertyContainer");                        
                    foreach (KeyValuePair<string, string> pair in contextProperties)                         
                    {                             
                              XmlElement prop = xDoc.CreateElement(pair.Key, "https://R4A.Properties");                             
                              prop.InnerText = pair.Value;                            
                              rootNode.AppendChild(prop);                         
                    }                        
                    xDoc.AppendChild(rootNode);                        
                    var header = new MessageHeader<string>(HttpUtility.HtmlEncode(xDoc.InnerXml));                         
                    var untyped = header.GetUntypedHeader("PropertyContainer", "https://R4A.Properties");                         
                    OperationContext.Current.OutgoingMessageHeaders.Add(untyped);                    
               }                    
               
               response = client.SubmitMessage(message);                 
          }                
          
          ((IClientChannel)client).Close();   
          
     }catch(Exception ex)             
     {                     
          ((IClientChannel)client).Abort();             
     }            

     return response;   
      
}

That’s it!
Now simply call the “SendMessage” method and you can send a stream to BizTalk and receive a stream back.
This way my website doesn’t need to read the message and no memory problems can be encountered, because everything works streaming.
And using the custom WCF header, I can still add some extra information to the message.

I couldn’t find a similar blogpost about this subject, so hopefully this will help you :)

Posted in: BizTalk | WCF

Tags: , ,


October 10, 2012 at 3:42 PM

On one of the projects we were doing, we needed to migrate the BizTalk 2006 R2 applications to BizTalk 2010.
This gave us the chance to change the running SOAP BizTalk services to WCF services. These services have more capabilities and are easier to configure.
We only had one restriction: the clients may not be forced to change. After some searching on the web, I found following post:

http://maximelabelle.wordpress.com/2010/08/12/creating-soap-compatible-biztalk-wcf-services/ and I like to share it with you.

First of all, I will explain how to expose a schema as a WCF Service;

Expose a Schema as a WCF Service

To create a WCF-service, use the BizTalk WCF Service Publishing Wizard. You can find it in the BizTalk Server 2010 folder at the Windows start menu.

clip_image001[5]

With this wizard you can set up the service endpoint.
You can choose between WCF-BasicHttp, WCF-WSHttp and WCF-CustomIsolated as a transport type and choose the application where you want to create the receive location in BizTalk.

clip_image002[2]

At the next step you get the choice to choose if you want to expose an orchestration or a schema as a WCF Service. In our case we will choose the schema choice.
The wizard gives you a tree of service methods, operations and request-response. Here you can add methods and one- or two-way operations. Define the schema type for your request and/or response from an assembly.

clip_image003[2]clip_image004[3]

clip_image005[2]clip_image006[2]

Fill in the target namespace of the WCF Service and choose the host and web directory where the service will be reachable.

The last step is a summary of the service you are going to create.... congratulations, you have created a WCF Service in BizTalk!

A new site is created in IIS and a receive location has been created for this service. The URI property refers to the address of the site in IIS.

Look also at the Receive Handler which is the BizTalkServerIsolatedHost. This means that this port is running under IIS.

clip_image007[2]

clip_image008[2]

Check if the receive location is started and if the Application pool of the site has the correct identity to work with BizTalk.

clip_image009[1]

If you try to browse to the site and receive a login error then you have to give the application pool the correct identity.

If after browsing to the site and you receive the following screen, you have created a WCF service with success.

clip_image010[1]

Change the Service to be able to communicate with the old SOAP-clients

First thing you need to do, is download the WSDL of the old SOAP Service and store it in the same folder of your SVC-file.

Open the WSDL and change the address location to the URI of the SVC-service.

When you look in the folder where the SVC-file is situated, there is also a web.config file of the service.

Load this web.config file in the WCF Service Configuration Editor for easy modifying.

clip_image011[1]

Go to the advanced tab and open the Service Behavior. Open the configuration and in the Service Metadata\ExternalMetadataLocation you have to add the path to the old WSDL. Save the config and close the configuration editor.

Now if you go to the service you will see that the URL of the WSDL has changed, also the WSDL itself now refers to the old one.

For the last step, you will need to change the Inbound BizTalk message body and the outbound WCF message Body.

The old ASMX message has one node more than a WCF envelope. You have to tell BizTalk were to get the find the message in the received envelope.

Open the settings of the receive location and click on configure, go to the message Tab. In the Inbound BizTalk message body check the path option and use the xpath '”/*/*” to go to the child node of the received message.

clip_image012

For the outboundWCF message body you need to wrap your message in an extra node because the client is demanding an extra Operation node as a wrapper. You also have to give this node the service namespace.

Restrictions, this pattern can only be used when you have a service that only has one operation due to the wrapper element you have to declare in the outbound WCF message body.

Hope this helps.
 - Robert Maes


June 7, 2012 at 5:47 PM

After years of publishing BizTalk WCF-Services and countless hours spend configuring the services in the wizard I just recently found out the WCF-Publishing Wizard can be started with a configuration file provided.

Actually the configuration file is generated after you published your service for the first time.

The configuration file ‘WcfServiceDescription.xml” is located in the App_Data/Temp subfolder in the folder where the service has been published:

clip_image002

 

To start the wizard with a configuration file, fire up a command prompt (using Administrative privileges). Start the wizard with the /WcfServiceDescription option and provide the configuration file:

clip_image004

 

In the “Create WCF Service” page of the wizard select the correct option:

clip_image005

 

The page that describes your service will have all information from your previous configuration:

clip_image006

 

As always there is one caveat:

The target namespace of the service is reset to the default and needs to be configured:

clip_image007

 

This definitely took the pain out of updating my services …

Posted in: BizTalk | WCF

Tags:


April 19, 2012 at 3:33 PM

Recently, we wanted to create multiple WCF services that should communicate with each other through the netMsmqBinding binding and we wanted to use a clustered MSMQ service.
However we encountered some problems and wanted to share them with you.

Situation: We run MSMQ as a part of resource group on a cluster. The service is hosted in WAS and the application pool runs under a functional user.

1. Without Windows Integration

Note: In our WCF service the security mode is set to "None".

When our services ran and started to communicate with each other we did not get any messages  in the queue as we expected, actually we did not find any message on the clustered MSMQ but we saw in our tracing that the WCF service did not report any error to place a message on the queue.

After some investigation we found all test messages in the local System queue “Transactional dead-letter messages” with the report “Access denied”.

So our first thought was to check the MSMQ security on that particular queue: we started up mmc, connected to the clustered resource e.g. “MyclusteredResource” to check on the MSMQ security:

 


There we wanted to check the security on a queue (by right clicking on the queue) we noticed we did not have a properties option.

 


It seems that you cannot configure MSMQ security when connecting through the mmc console.
Microsoft pointed out that we should use an other tool to configure the security (mmcv.exe).

You can download mmcv.exe : http://www.microsoft.com/download/en/details.aspx?id=18189

 

You use it as follows on the active node (Where the MSMQ resource is running):  
"<drive>:\<directory>\mmcv -s <Network Name of the clustered MSMQ resource>" 
 

When you drill down to the MSMQ queues we finally got the properties option. So we went on to check the security.

 

Note: If you are running the mmcv.exe tool on the non-active node you will not find the Message Queueing option.

It seemed that Everyone had full control and yet we got the error message “Access denied”

 

After a bit of searching we found the following KB article: http://support.microsoft.com/default.aspx?scid=kb;EN-US;952570 and following blog http://blogs.msdn.com/b/tomholl/archive/2008/07/13/msmq-wcf-and-iis-getting-them-to-play-nice-part-2.aspx

This explained why we got the error message the message does not include the security header. Therefore, the message does not contain the user ID of the sender "

 

So we added the “ANONYMOUS LOGON “ to the users and gave him the appropriate rights to read / write on the queue.

 

After that we ran a test and all messages were delivered on the clustered MSMQ! 

In the next step I’ll show you how you can check and enable the Windows Integration on your server...

 

2. With Windows Integration

Through the Features option in the server manager (Server 2008) you need to check if Directory Service Integration is enabled. Be aware that you need to do this for each node.

 

 

 

Once this feature is installed and your resources went online, an MSMQ object should be created in the active directory record of your network resource hosting your MSMQ e.g. “MyclusterresourceYou” can check it by the following steps:

Open the Active directory Users and Computers.

 

Through the View otpion select "Users, groups and computers as containers"

 

Finally search for your network resource and check if it has a MSMQ object.

 

 

If you don’t find any MSMQ object it is possible that when Directory Service Integration is installed afterwards no MSMQ object is created (more info: http://support.microsoft.com/default.aspx?scid=kb;EN-US;935498)

 

Once that is fixed, for Windows Integrated security you only need to add your user in the MSMQ security with mmcv.exe

Change your WCF security mode to "Transport" and enable the msmqAuthentication mode so your WCF service is ready to use Windows Authentication.

 

 

When you get the following error while starting your WCF service: "Binding validation failed because the binding's MsmqAuthenticationMode property is set to WindowsDomain but MSMQ is installed with Active Directory integration disabled. The channel factory or service host cannot be opened" then you need to check the MSMQ object in the active directory (see previous steps).

 

Jonathan Maes

 

 

Posted in: MSMQ | WCF

Tags: , ,


April 12, 2012 at 1:42 PM

This is a post, describing an issue we recently had on the Azure Service Bus. 

 

Situation description

When a single appdomain is opening two (or more) service bus relay endpoints that have the same path (what is added after the servicebus.windows.net), but have a different namespace, the following exception is raised:

System.InvalidOperationException: The ChannelDispatcher at 'sb://repro2.servicebus.windows.net/ordersvc' with contract(s) 'ICustomerService' is unable to open its IChannelListener. ---> System.InvalidOperationException: A registration already exists for URI 'sb://repro2.servicebus.windows.net/ordersvc'.

The following is the configuration of my endpoints (not including the TokenProvider, etc, just the endpoints.

        <endpoint address="http://repro1.servicebus.windows.net/ordersvc"
            binding="basicHttpRelayBinding"
            bindingConfiguration="httpRelayBinding"
            contract="Demo1.Relay.ICustomerService"
            behaviorConfiguration="repro1Behavior" />
        <endpoint address="http://repro2.servicebus.windows.net/ordersvc"
            binding="basicHttpRelayBinding"
            bindingConfiguration="httpRelayBinding"
            contract="Demo1.Relay.ICustomerService"
            behaviorConfiguration="repro2Behavior" />

Why do we need the same services exposed on different namespaces?

Environment seperation

For Codit Integration Cloud, our azure-based integration platform, we are consuming some on-premises web services, exposed over the Azure Service Bus relay binding.  We do this for different services that make part of our runtime.  We also have a deployment cycle where we have different environments (a development, a test, a demo and off course the production environment(s)).

To isolate services, we make sure that every environment has a specific service bus namespace.  This allows for security segregation and to move services on premises, without touching other environments.  So this means that for our EdiFactParser service, we have the following endpoints (different names are being used here):

  • sb://intcloud-dev.servicebus.windows.net/onprem/parse
  • sb://intcloud-test.servicebus.windows.net/onprem/parse
  • sb://intcloud-demo.servicebus.windows.net/onprem/parse
  • sb://intcloud-prod.servicebus.windows.net/onprem/parse

As you can see the only difference in the above mentioned endpoints are the service bus namespaces.  As mentioned, these services are hosted on different servers on premises, but in some cases, we host them together.  (for example: dev & test are sharing the same local server).  In our cases, these services are hosted in BizTalk Server receive locations.

Disaster recovery

In the rare case where an Azure center would be out of the air, all service bus namespaces (hosted in that data center) are unavailable.  (There might be something like service bus federation in the future, but that’s not there yet).  To make sure that our on premises services are still available, we could expose these services on multiple service bus namespaces.  (hosted in different data centers).

In the case of a namespace being unavailable, the client that consumes the service could failover and try to consume the service over the second namespace.

How to work around this

This seems to be a bug in the Service Bus dll implementation, but we didn’t got a confirmation of this by product team yet.  (there might be a good reason for this, allthough I don’t see it).  Anyway, to workaround this, you need to open the different endpoints in separate service hosts.  The following describes how to do this.

In BizTalk Server

We initially had the issue on BizTalk Server, where we expose these services over the service bus.  Both receive locations were hosted in the same BizTalk host.  Just moving both locations to a different BizTalk host, solved the problem. 

In regular .NET applications

If you open the service host yourself, it as easy as creating two instances of the ServiceHost class and have them opening the endpoints seperately.

 

Just wanted to share this one

Sam Vanhoutte


April 3, 2012 at 11:52 AM

Many of us at Codit already installed the WCF LOB SDK multiple times. And in the process we have learned to know the caveats that come with the installation:
- 32 bit vs 64 bit
- Adapter Pack installation (again, 32 bit vs 64 bit)
- Enterprise application installation

Now since BizTalk 2010, there is a great wizard added to the installation screen if you click “Install Microsoft BizTalk Adapters”:

image 

The screen shows up like this once you go through the entire installation:

image

Please note that the above screenshot is from a production server where I don’t have Visual Studio installed, so I could not install the developer tools (hence the warning)

It is a very welcome change, because before BizTalk 2010, people did not know exactly what they needed to install and in which order.
Now the screen gives you a very handy wizard-style interface.

Now recently I had a strange error: on a 64-bit machine I went through the installation.
I was sure that everything was installed correctly and in the right order!

I checked all machine.config files (for framework 2.0 and 4.0, both 32-bit and 64-bit) and all had the necessary entries added.
However, there was no way I could see/add the WCF LOB Adapters in the BizTalk console:

image

I went through a lot of online searching until I accidently stumbled upon the BizTalk modify wizard:

image

It happens that the WCF Adapter components in BizTalk were not installed, so the WCF adapters were not showing up for a good reason!

When I checked both checkboxes (WCF for BizTalk Runtime and Administration Tools And Monitoring), installed it on both nodes and re-opened the BizTalk consoles, I could add the WCF adapters I needed.

image

I hope this helps at least someone!

Posted in: BizTalk | LOB | WCF

Tags: , , ,