Session variable in WCF application

I need to use or stimulate a very simple session object inside my WCF application.

I just need to save some values ​​at the beginning of the call, and I need access to these values ​​when I look at several different methods of my service.

An Asp.NET session would be very useful to use, so I need to find out what is available in the WCF application to store such values.

Note. This is just a session for each communication session, I do not need to save this session between different calls from the client to the service, etc.

+5
source share
2 answers

, ( , ) HttpContext.Items, ASP.NET.

WCF OperationContext, HttpContext. Items , , , .

+4

.

aspNetCompatibilityEnabled = true ( system.ServiceModel | serviceHostingEnvironment)

( ) - :

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

, allowCookies true.

<basicHttpBinding>
 <binding name="SessionBinding" allowCookies="true">
</basicHttpBinding>

, , ?

+2

All Articles