本文介绍了WCF单信道性能VS多通道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一遍又一遍地重复使用相同的WCF通道的应用程序。我一直在通过工厂对象的静态引用。我不知道这是很好的初步实践或者说我应该打开x通道和循环赛过这些通道,而不是使用单通道的所有服务电话?

I have an application that reuses the same WCF channel over and over again. I keep a static reference through a factory object. I wonder if this is good pratice or that I should open x channels and round robin all services calls over these channels instead of using the single channel?

做这些服务调用get如果只使用1个通道还是一样发生时,我会用x通道排队?

Do these services calls get queued if using only 1 channel or does the same happen when I would use x channels?

推荐答案

您应该使用单独的通道工厂所有的请求,但不同的渠道,应构建为每个请求。不要重复使用渠道。他们不是创造昂贵,不是线程安全的。什么是创造便宜的是通道工厂。它是线程安全和可重复使用。当然,如果通道工厂进入故障状态,你可能需要重新打开它。

You should use a single channel factory for all requests but different channels should be constructed for each request. Never reuse channels. They are not expensive to create and are not thread safe. What is expensive to create is the channel factory. It is thread safe and can be reused. Of course if the channel factory get into a faulted state you might need to reopen it.

这篇关于WCF单信道性能VS多通道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 04:10