Single WCF channel performance vs multiple channels

后端 未结 2 1225
情书的邮戳
情书的邮戳 2021-02-08 13:21

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

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-08 13:45

    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.

提交回复
热议问题