views:

1284

answers:

1

I'm building some routing functionality between services. The original service and the service that does the routing have an identical configuration; both are using netTcpBinding with the following binding configuration:

netTcpBinding

security mode="Message"

message clientCredentialType="UserName"

The service behavior uses a AspNet Membership Provider and a client certificate we've installed on the machine.

When I switch off the message security it relays just fine but when it's switched on I get the following exception:

"The message could not be processed. This is most likely because the action 'http://foo/Whatever' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings*. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding." (Emphasis mine)

My thinking is that the certificate is operating on the message twice (once on the original call and then on the relay) and this is what corrupts the message's security token.

Questions:

  1. Is my thinking on target?

  2. Is there a way to continue to use message security for routing without having the complexity of a token service?

+1  A: 

You mentioned switching between no security and message security. Are you making sure to change both the WCF service endpoints as well as the endpoint on the receiving end? If not, and the two do not match up, you will receive an error. That's what that error seems to be saying to me.

For Question 2, what type of environment are you running in? A closed system where you could use encrypt and sign, or a public environment, where you might need to be using a special key?

Noah