开发者

How to get a PerSession context with WCF?

开发者 https://www.devze.com 2023-01-02 22:00 出处:网络
I got running a WCF service with custom binding, for now it use httpTransport. <customBinding> <binding name=\"myHttpBindingConf\">

I got running a WCF service with custom binding, for now it use httpTransport.

<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 
0

精彩评论

暂无评论...
验证码 换一张
取 消