Is WCF ClientBase thread safe?

前端 未结 4 1772
庸人自扰
庸人自扰 2020-12-10 10:59

I have implemented ClientBase to use WCF to connect to a service. I\'m then calling a method on the channel to communicate with the service.

base.Channel.Cal         


        
4条回答
  •  [愿得一人]
    2020-12-10 11:30

    Yes, it is thread-safe. However, you should know that WCF will automatically serialize the execution of CalculateSomething when it is called from more than one thread using the same ClientBase instance. So if you were expecting CalculateSomething to run concurrently then you will have to rethink your design. Take a look at this answer for one approach to creating an asynchronous API for the CalculateSomething method.

提交回复
热议问题