Setting AddressFilterMode

I was experimenting with a WCF Worker Role for my Cloud sample and I encountered this error for my Workflow Service.

"The channel received an unexpected fault input message while closing. The fault reason given is: 'The message with To 'net.tcp://localhost:18090/ExpenseWorkflowService' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.'"

I read that I will need to put an attribute like the following on my WCF Service

[ServiceBehavior(AddressFilterMode=AddressFilterMode.Any)]

Errr... the problem is, this is a WorkflowService and it only contains a .xaml file. So, how am I going to decorate a ServiceBehavior attribute on it?

After searching for a while, I can't seem to find anything on the Internet. There was this suggestion of creating a custom behavior to do it but I felt that it was a little overkill and there must be an easier way.

I ran a trace on my ExpenseService and found out that ServiceBehaviorAttribute was one of the Behaviors. So, I went to add the following for my ExpenseWorkflowService in the host code and it works!

// Set AddressFilterMode

ServiceBehaviorAttribute serviceBehavior = new ServiceBehaviorAttribute();
serviceBehavior.AddressFilterMode = AddressFilterMode.Any;
_wfSvcHost.Description.Behaviors.Add(serviceBehavior);

No comments:

Post a Comment

Popular Post