tags:

views:

1868

answers:

1

I've written mostly working piece of code using WCF where a client subscribes to a server and the server pushes data to the client.

I left is running for a while and tried to puch some data to the client and got an exception which told me I had to set the receiveTimeout property.

Where can I set this property? Everywhere I see this issue addressed it looks like the WCF code has been generated using svcutil.exe I've not done this and I don't really want to start again from scratch.

+3  A: 

I've found out how to do this, when creating the pipe client side you have to explicitly set the time out on the binding.

NetNamedPipeBinding binding = new NetNamedPipeBinding();
binding.ReceiveTimeout = new TimeSpan(1,0,0);
binding.SendTimeout = new TimeSpan(1,0,0);
DuplexChannelFactory<IVdnServer> pipeFactory = new 
    DuplexChannelFactory<IVdnServer>(_subscriber, binding, 
        new EndpointAddress("net.pipe://localhost/PipeService"));

And when you are creating the service endpoint server side you also have to explicitly set the time out.

NetNamedPipeBinding binding = new NetNamedPipeBinding();
binding.ReceiveTimeout = new TimeSpan(1,0,0);
binding.SendTimeout = new TimeSpan(1,0,0);

_host.AddServiceEndpoint(typeof(IVdnServer),binding , "PipeReverse");
Omar Kooheji