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;
}
}