How to get a PerSession context with WCF?
<customBinding>
<binding name="myHttpBindingConf">
<context contextManagementEnabled="true" protectionLevel="None"
contextExchangeMechanism="ContextSoapHeader" />
<textMessageEncoding/>
<httpTransport useDefaultWebProxy="false" />
</binding>
</customBinding>
I've Made a custom IExtension<OperationContext>
to stock my data in a specific context by following those instructions:
http://hyperthink.net/blog/a-simple-ish-approach-to-custom-context-in-wcf/
I would like to use a ContextMode.PerSession
context.
Which transport choose to get Session management?
How to set new transport in place and lettin开发者_开发百科g object discovery enabled? How to force a PerSession context?The ability to establish a session does not necessarily depend only the used transport. E.g. you can use WS-SecureConversion to establish a session and still use HTTP(s) transport.
Check http://msdn.microsoft.com/en-us/library/ms733040.aspx section "System-Provided Session Types".
Also you would usually tie your service instance to a session, not the operation context.
You specify it in the implementation of your service rather than in a config file
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)]
public class MyService : IMyService
精彩评论