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 is a separate operation, and there is no need to keep any session state.
I am running into a problem with load balancer, because WCF keeps re-using security tokens, so if the first call goes to NodeA, it creates a security token which is re-used. If that token is passed to NodeB tripping up MessageSecurityException
Seems like microsofts answer to this is to use sticky sessions, which is something we explored but it does not make sense in our setup
Is there a way to simply force WCF to create a new Security Token on every call? (while using Message level security with Windows credential type?
update
i setup trace on client / server and i can i see that the token is cached for 24 hrs.
<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 IssuanceTokenProvider used the cached service token.
i've tried disabling token cashing 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 appears that above doesn't affect the negotiation at all.
i am still seeing that cached tokens are used.