I have a service that looks like this:
[ServiceContract(SessionMode = SessionMode.Required)]
public interface ILabListener
{
[OperationContract]
byte[] GetChallenge();
...
...
[ServiceBehavior(IncludeExceptionDetailInFaults = true, InstanceContextMode = InstanceContextMode.PerSession)]
class LabListener : ILabListener
{
private byte[] challenge;
public LabListener()
{
[challenge is initialized to random data from RNG]
File.AppendAllText(Program.LogPath, String.Format("{1} - Starting LabListener session: {2}, challenge: {3}{0}",
Environment.NewLine, DateTime.Now, OperationContext.Current.SessionId, Convert.ToBase64String(auth.Challenge.Take(16).ToArray())));
}
public byte[] GetChallenge()
{
return challenge;
}
...
...
var binding = new NetTcpBinding(SecurityMode.None);
host = new ServiceHost(typeof(LabListener), new Uri(String.Format("net.tcp://{0}:800/LabListener", Environment.MachineName)));
host.AddServiceEndpoint(typeof(ILabListener), binding, "");
...
LabListenerClient client = new LabListenerClient();
Console.WriteLine(Convert.ToBase64String(client.GetChallenge());
Console.WriteLine(Convert.ToBase64String(client.GetChallenge());
When this service is hosted on MS.net on Windows, the output of each GetChallenge is the same, and the constructor for LabListener is called only once.
If I place this in mono 2.6.7 in OpenSuSE 11.3, for each GetChallenge call a new LabListener is created and two different values are returned.
this is the output of the log on the server in Linux:
8/26/2010 8:07:57 PM - Launching the LabListener session: urn: uuid: 5e41d193-c723-4839-abc0-93103dbd63f1, call: hDPwoofYUrEjAJ1Q8cWDYw ==
8/26/2010 8:07:57 PM - Launch LabListener Session: Urn: UUID: 5e41d193-c723-4839-abc0-93103dbd63f1, call: 6 / 3M4EhiKrAMM2j47MCIpQ ==
How to change mono behavior?