MSDN Archive Home
Help and FAQs
Silverlight Web Services Samples
All Resource Updates
Create New Discussion
Duplex Service as a PerSession service?
Feb 4 2009 at 8:09 PM
I am developing a Silverlight duplex application based on the duplex sample. However, I need the service to run with PerSession instancing, not the singleton instance as the sample is programmed. I tried just changing the InstanceContextMode property of the ServiceBehavior attribute on the DuplexService to InstanceContextMode.PerSession, but this resulted in an exception being thrown in the CompleteSend() method of the DuplexReceiver. So obviously, more code changes are required to implement this service for PerSession instancing.
Do you know what changes are required to support this? I am still fairly new to WCF programming, so any advice you can offer would be greatly appreciated.
Feb 5 2009 at 5:00 PM
I believe I solved this. In DuplexServiceFactory.CreateServiceHost() method, I changed the first statement to
ServiceHost service = new ServiceHost(typeof(T),baseAddresses);
and also changed the InstanceContextMode of the ServiceBehavior attribute of the DuplexService to InstanceContextMode.PerSession.
Everything seems to function properly...my service returns the expected data to the Silverlight client.
Sign in to post message or set email notifications
Manage Your Profile
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.