named pipe callback takes 10 seconds?

随声附和 提交于 2019-12-11 03:33:09

问题


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?


回答1:


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)



回答2:


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




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/8868479/named-pipe-callback-takes-10-seconds

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!