I can't get my values stored in the WCF session when use WS2007FederationHttpBinding. I've seen this topic Session in WCF not consistent, but it didn't help. Moreover, I don't care about reliable session, I just want to store some info in the session and read it at the second request. This scheme works for me with basicHttpsBinding.
Here is my binding. After channel creation I store it to the client Session
var binding = new WS2007FederationHttpBinding(WSFederationHttpSecurityMode.TransportWithMessageCredential);
binding.Security.Message.EstablishSecurityContext = true;
binding.Security.Message.IssuedKeyType = SecurityKeyType.BearerKey;
binding.MaxReceivedMessageSize = 4000000;
var serviceFactory = new ChannelFactory<T>(binding, new EndpointAddress(serviceUrl));
serviceFactory.Credentials.SupportInteractive = false;
var channel = serviceFactory.CreateChannelWithIssuedToken(token);
Service configuration:
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
Session access in the service:
HttpContext.Current.Session["serviceSession"] = "123";
Session retrieval in the service (is always null on the second request but SessionId is the same):
if (HttpContext.Current.Session["serviceSession"] == null) ...
I keep the channel itself in the client session between two requests and reuse it taking from the session for the second request.
Session["clientSession"] = channel;