Reputation: 16920
I have a service which is being called from WP7. I know WP7(Silverlight) only supports basicHtptBinding till today and unfortunately it doesn't support Session so I can't use InstanceContextMode.PerSession and SessionMode.Required in this service. But I have some data on server which I need to be preserve it on session basis. What options do I have?
Upvotes: 5
Views: 818
Reputation: 346
You could use a ConcurrentDictionary in a static class on the server-side to cache the object using the user's identity as a key. If you need the cache around for a very long time, you'll want to host the service in a Windows Service, to avoid issues with app pool cycling, etc.
Upvotes: 1
Reputation: 6588
I'm not familiar with Windows Phone 7 programming, but if it will allow you to use basicHTTPContextBinding, which is a flavor of basicHTTPBinding, then I suggest you look into a Durable Service.
Durable services allow you to save session state in some persistent storage and access it with each new method call via a token.
Take a look at the blog article at this link.
Even if you can't create a formal Durable service, you may be able to create something with a similar idea - pass a token (login/userid or something) and read state from persistent storage - database table or something.
Let us know if you get it working!
Upvotes: 2