WCF Service timeout in Callback

Posted by Muckers Mate on Stack Overflow See other posts from Stack Overflow or by Muckers Mate
Published on 2013-11-09T15:50:53Z Indexed on 2013/11/09 15:53 UTC
Read the original article Hit count: 413

Filed under:
|
|
|

I'm trying to get to grips with WCF, in particular writing a WCF Service application with callback.

I've setup the service, together with the callback contract but when the callback is called, the app is timing out.

Essentially, from a client I'm setting a property within the service class. The Setter of this property, if it fails validation fires a callback and, well, this is timing out.

I realise that this is probably to it not being an Asynchronous calback, but can someone please show me how to resolve this?

Thanks

  // The call back (client-side) interface
public interface ISAPUploadServiceReply
{
    [OperationContract(IsOneWay = true)]
    void Reply(int stateCode);
}

// The Upload Service interface
[ServiceContract(CallbackContract = typeof(ISAPUploadServiceReply))]
public interface ISAPUploadService
{

    int ServerState
    {
        [OperationContract]
        get;
        [OperationContract(IsOneWay=true)]
        set;

And the implementation...

public int ServerState
    {
        get 
        { 
            return serverState; 
        }
        set 
        {
            if (InvalidState(Value))
            {
               var to = OperationContext.Current.GetCallbackChannel<ISAPUploadServiceReply>();
               to.Reply(eInvalidState);
            }
            else serverState = value; 
        } 
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf