Hi,

This issue has been driving me a little crazy.

I've setup a wcf service with duplex communication and it works well
for one way functions. i.e. my contract looks a bit like this

[ServiceContract(SessionMode=SessionMode.Required,
CallbackContract=typeof(ILogMessaging)]
public interface IMyContract
{
   [OperationContract(IsOneWay=true)]
   void DoSomething();
}

The implementation of DoSomething() invokes the callback of
effectively sends back a log message to the client, and it all works
nicely, the message appears at the client.

The problem is when I want to put in a function that returns a value
and uses the callback. So, for example:

   [OperationContract]
   DateTime WhatIsTheTime();

with implementation:
DateTime WhatIsTheTime()
{
   Callback.LogMessage("you asked for the time");
   return DateTime.Now;
}

The client ends up timing out, and throws a timeoutexception. I've
read that because the service is single-threaded you get a deadlock
situation where client and server are both waiting for each other to
finish, so I guess this is what is causing the timeout. The solution
they say is to set the concurrency behaviour to Reentrant or Multiple.

But I don't understand this. I've set my callback function to
IsOneWay=True, and besides, when debugging I can see that execution
moves past the Callback statement. So I don't know what the client is
waiting for. I've tried changing the concurrency behaviour to
Reentrant or Multiple, but that didn't make any difference (was i
doing it wrong?)

Is there a way around this, or is it not possible to have this type of
behaviour? Am I trying to have my cake and eat it?

Thanks for your help,
Tim

Reply via email to