I have a WCF Service that is configured by net.tcp binding. I can reach the service by client and can call methods of it. Also I can reach the OperationContext.Current. Such as:
[ServiceContract(CallbackContract = typeof(IServiceCallback))]
public interface IService
{
[OperationContract(IsOneWay = true)]
void Register();
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
public class Service :IService
{
public void Register()
{
CallBacker.Client = OperationContext.Current.
GetCallbackChannel<IServiceCallback>();
}
}
}
public class CallBacker
{
public static IServiceCallback Client { get; set; }
public void Call(string message)
{
Client.Test(message);
}
}
When the client calls the Register method of Service, I can see channel is stored on CallBacker.Client but when I call "Call" method of the CallBacker > Call(string message), the Client comes null.
The strange thing is when I set the service configuration from net.tcp to wsdualhttpbinding, it works perfect. Is there any different between net.tcp and wsdualhttpbinding that can cause this strange problem ?