Note that there are some explanatory texts on larger screens.

plurals
  1. POSilverLight Enabled Wcf Service - can't keep track of session
    primarykey
    data
    text
    <p>I'm new to Silverlight and WCF services. I'm trying to write a client application that can manipulate an object server side. </p> <p>My problem is that each time my Silverlight client makes a call to the service, it enters into the constructor systematically</p> <pre><code>public SilverLightEnabledWcfService() { } </code></pre> <p>In the below example, I simply want to increment or decrement a number depending on the activity client side. </p> <p>How am I supposed to do this properly?</p> <p>I also tried to create a regular ASP.net client page and I got the same result, ie the server doesn't remember the session. So I don't think the problem is in my client, but I'm still happy to post the code if it helps.</p> <p>Thanks !!</p> <pre><code>using System; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.ServiceModel.Activation; using Count.Library; namespace Count.WebApp { [ServiceContract(Namespace = "")] [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession)] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] public class SilverLightEnabledWcfService { public SilverLightEnabledWcfService() { } private Class1 _class1; [OperationContract] public int Add1() { if (_class1 == null) _class1 = new Class1(0); _class1.Add1(); return Value; } [OperationContract] public int Remove1() { if (_class1 == null) _class1 = new Class1(0); _class1.Remove1(); return Value; } public int Value { get { return _class1.Count; } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload