Nahum
Nahum

Reputation: 7197

named pipe callback takes 10 seconds?

got wcf dll with client and server classes wraping it.

when my server uses callback it takes over 10 seconds for my client to get it..

what is going on?

only got simplest NetNamedPipeBinding endpoint.

got lots of code so I'm not sure what to paste here.

what can cause such a long time.

EDIT: only first callback takes 10 seconds..

after this it works fast.

any one knows why?

Upvotes: 2

Views: 1247

Answers (4)

fan711
fan711

Reputation: 716

Accidentally I found a setting that greatly improves performance of the first WCF request. The time came down from > 10 seconds to ~2 seconds.

Set binding's TransferMode property to Streamed both on server and client:

var binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);
binding.TransferMode = TransferMode.Streamed;

Then pass the binding into AddServiceEndpoint server-side and into Channelfactory constructor client-side.

Upvotes: 1

Nahum
Nahum

Reputation: 7197

Nothing helped. I ended up to add a fake call decorater. that sends the first call when the system is booting.

Upvotes: 1

Yuriy
Yuriy

Reputation: 23

I had similar problem. This helped in my case:

NetNamedPipeSecurity security = new NetNamedPipeSecurity() { Mode = NetNamedPipeSecurityMode.None };

Pass this security object when creating the binding:

new NetNamedPipeBinding() { Security = security }

The original idea is from here. The thread was about TCP binding, but the solution presented at the end appeared to be helpful for named pipes too in my case.

Even simpler is to do:

new NetNamedPipeBinding(NetNamedPipeSecurityMode.None)

Upvotes: 2

GazTheDestroyer
GazTheDestroyer

Reputation: 21261

How are you hosting your service? The first call will need to create the service which can be slow to startup.

When debugging I use Studio's built in service host, and this often takes several seconds to sort itself out. Don't think I've ever seen it take 10 seconds mind.

Upvotes: 0

Related Questions