0
Answer

WCF Dual-Service run into timeout

Norbert Siegel

Norbert Siegel

15y
3.8k
1

Hello,

we have a problem with a WCF Service using wsDualHttpBinding or netTcpBinding. The folowing Code works fine, but if we move the code from the Constructor to the method "Start()" than the client gets a timeout, when calling "RegisterObserver()".

 

Have you any idea ?

 

Greats

Norbert

 

 [ServiceContract(

        Name = "ObserverService",

        Namespace = "http://VarioBatch/ObserverService/",

        SessionMode = SessionMode.Required,

        CallbackContract = typeof(IVBObserverCallback))]

public interface IVBObserver

{

    [OperationContract()]

    int RegisterObserver();

 

    [OperationContract(IsOneWay = true)]

    void UnregisterObserver();

}

 

 

public interface IVBObserverCallback

{

    [OperationContract(IsOneWay = true)]

    void ReceiveSPSData(Guid vbO1ProcessCellID, string spsData);

}

 

 

public class AppContextClient : ObserverServiceCallback

{

    public ObserverServiceClient _VBObserverClient = null;

 

    public AppContextClient()

    {

        //_VBObserverClient = new ObserverServiceClient(new InstanceContext(this), "HttpBinding");

        _VBObserverClient = new ObserverServiceClient(new InstanceContext(this), "TcpBinding");

        _VBObserverClient.Open();

    }

    public override void Start()

    {

        _VBObserverClient.RegisterObserver();

    }

 

 

    #region ObserverServiceCallback Members

    public void ReceiveSPSData(Guid vbO1ProcessCellID, string spsData)

    {

        System.Diagnostics.Debug.WriteLine(spsData);

    }

    #endregion

}