In inherited a project that uses a ChannelFactory instead of a Client for WCF calls. Why would you do that?
Also, is it safe to cache the result of a ChannelFactory.CreateChannel() call or should you create a new one each time?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Creating the WCF client is a two-step process:
Step 1 is rather expensive in terms of processing power and speed – so if you can create the channel factory and then cache is somewhere, you can save yourself a bit of resources and create a channel off that cached channel factory will be faster than re-creating the whole client all the time.
So in this setup, I would try to cache the
ChannelFactory, if you can – and re-create the channel from that factory every time you need it.