I am using WCF message level security with the following wsHttpBinding
<security mode="Message"> <message clientCredentialType="Windows" establishSecurityContext="false" /> </security>
Each time I call the service, it is a separate operation, and there is no need to save the state of the session.
I'm having a problem with the load balancer because WCF continues to use security tokens, so if the first call goes to NodeA, it creates a security token that is reused. If this token is passed to NodeB, a MessageSecurityException is thrown.
It looks like Microsoft advises using the sticky sessions that we learned, but that doesn't make sense in our setup.
Is there a way to simply force WCF to create a new security token on every call? (when using message-level security with a Windows credential type?
Update
i configure the trace on the client / server, and I can see that the token is cached for 24 hours.
<ServiceToken> <SessionTokenType>System.ServiceModel.Security.Tokens.BufferedGenericXmlSecurityToken</SessionTokenType> <ValidFrom>2013-03-23T21:21:32.569Z</ValidFrom> <ValidTo>2013-03-24T07:21:32.569Z</ValidTo> <InternalTokenReference>LocalIdKeyIdentifierClause(LocalId = 'uuid-291b4a38-af17-4832-bc7a-6fb65dcc3c3c-18', Owner = 'System.ServiceModel.Security.Tokens.SecurityContextSecurityToken')</InternalTokenReference>
The TokenProvider release uses a cached service token.
I tried disabling the issuance of tokens using the following:
IssuedTokenClientCredential itcc = service.ClientCredentials.IssuedToken; itcc.CacheIssuedTokens = false; itcc.LocalIssuerAddress = new EndpointAddress("http://localhost:####/myservice"); itcc.LocalIssuerBinding = new WSHttpBinding("my_wsHttp_bindingConfig"); itcc.MaxIssuedTokenCachingTime = new TimeSpan(0,0,0);
but, looking at the wcf trace, it seems that the above does not affect negotiations at all.
I still see cached tokens being used.
source share