user2017793
user2017793

Reputation: 55

How to use duplex in netnamedpipe in wcf 4.0

Is there any way that we can use netnamedpipe binding with duplex ? I am getting the following error.

Contract requires Duplex, but Binding 'NetNamedPipeBinding' doesn't support it or isn't configured properly to support it.

       ServiceHost host = new ServiceHost(typeof(MyService));
        NetNamedPipeBinding npb = new NetNamedPipeBinding();
        npb.MaxBufferSize = Int32.MaxValue;
        npb.MaxReceivedMessageSize = Int32.MaxValue;
        npb.OpenTimeout = new TimeSpan(200000);
        npb.CloseTimeout = new TimeSpan(200000);
        npb.SendTimeout = new TimeSpan(200000);
        npb.TransferMode = TransferMode.Streamed;

        host.AddServiceEndpoint(typeof(IMyService), npb, "net.pipe://localhost/MyService");
        host.Open();  // I am getting above error here

Please guide me.

Upvotes: 0

Views: 914

Answers (1)

JamesD
JamesD

Reputation: 460

Duplex communication works with a net named pipe binding. Try removing:

npb.TransferMode = TransferMode.Streamed;

Upvotes: 1

Related Questions