How do i use the ServiceBehaviour(InstanceContextMode = PerSession) with the webClient and calls from my ajax service. I want to execute the WCF REST Service in the PerSession mode so that i can have some in-memory variables such as username and passwords etc.
i.e. i want to maintain Session in my WCF REST service. Right now i can only do that when i set the InstanceContextMode = Single. Also, how do you auhtenticate the user with the WCF REST Service client?
I have to say that sessionful services are not very RESTful. Remember the point of REST is to build services that work the way the web works and the web is typically not session oriented. You can integrate ASP.NET security with membership in your solution
so you don't need to store username and password. The use of in-memory variables like this is probably not the right idea.
What is it you are trying to accomplish with the session? It sounds like you want to retain the username / password in memory so you can authenticate/authorize the call.
Ron Jacobs
Sr. Program Manager, AppFabric Developer Platform
http://blogs.msdn.microsoft.com/rjacobs
PerSession mode does not work with WCF REST services, you can enable ASP.NET compatibility mode for the service and use the regular Http Session to store those variables. By the way, single means singleton, only one instance of the service will be available
on the service, and it will be shared among all the users.
khasnis
0 Points
1 Post
InstanceContexMode = PerSession
Nov 10, 2008 07:50 PM|LINK
resources links wcfrest REST endpoint.tv WCF
ronjacobs
Member
32 Points
17 Posts
Re: InstanceContexMode = PerSession
Nov 11, 2008 06:13 AM|LINK
I have to say that sessionful services are not very RESTful. Remember the point of REST is to build services that work the way the web works and the web is typically not session oriented. You can integrate ASP.NET security with membership in your solution so you don't need to store username and password. The use of in-memory variables like this is probably not the right idea.
What is it you are trying to accomplish with the session? It sounds like you want to retain the username / password in memory so you can authenticate/authorize the call.
Sr. Program Manager, AppFabric Developer Platform
http://blogs.msdn.microsoft.com/rjacobs
ronjacobs
Member
32 Points
17 Posts
Re: InstanceContexMode = PerSession
Nov 11, 2008 06:24 AM|LINK
You can see a screencast about using ASP.NET membership with your WCF service at http://channel9.msdn.com/posts/rojacobs/endpointtv-Securing-RESTful-services-with-ASPNET-Membership/
REST endpoint.tv WCF
Sr. Program Manager, AppFabric Developer Platform
http://blogs.msdn.microsoft.com/rjacobs
cibrax
Member
722 Points
4 Posts
Re: InstanceContexMode = PerSession
Dec 04, 2008 04:29 PM|LINK
PerSession mode does not work with WCF REST services, you can enable ASP.NET compatibility mode for the service and use the regular Http Session to store those variables. By the way, single means singleton, only one instance of the service will be available on the service, and it will be shared among all the users.
Regards,
Pablo.