Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 862357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:07:42+00:00 2026-05-15T09:07:42+00:00

I have a WCF service that I consume in my code and generated as

  • 0

I have a WCF service that I consume in my code and generated as a ChannelFactory class. I know that the proper way to consume the WCF is to create the ChannelFactory (let’s call this AwesomeClient), do the work, then call Close() on it.
Here’s my snippet:

    public static void DoSomething()
    {
        var client = new AwesomeClient();
        client.DoSomethingAwesome();
        client.Close();
    }

However, I am expecting that DoSomething will be called quite frequently (say 10 times a minute?), so the advice I have gotten is to instantiate the ChannelFactory as a static instance, and always reuse the same instance, and never having to Close it (because this is ‘cheaper’ than always recreating the ChannelFactory and then closing it).

I’m here for a second opinion, can anyone tell me why not calling Close and reusing the static instance is a good idea? Or should I just stick with recreating the ChannelFactory and Close()-ing it for every call?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:07:42+00:00Added an answer on May 15, 2026 at 9:07 am

    10 times a minute is not that often. 10 times a second i would definitely at least consider reusing the channel.

    There is a lot of unknowns in your case to make a good decision. How many clients are going to be connecting to the service? What kind of connection is this (is there a chance it will go down for a fraction of a second), is there a load balancer? Proxy?

    and by the way, if you do decide to open and close the channel every time, there is no need to recreate the ChannelFactory. Keep that static, just open and close a new channel every time. Most of the time creating a factory consumes more resources.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Compact Framework 2.0 app that consume a WCF service. The data
I have a WCF service that I need to call in a ASP.NET web
I have a WCF service that works ok if I create the service without
I have the following code in a WCF Service that returns a string, and
I have a web service in WCF that consume some external web services, so
I have an async method in a WCF service, and a client that consume
I need to create a WCF Service that will have a download file function.
I have a WCF service that needs to be secured to be consumed by
I have a WCF service that accesses a SQL database to fetch data .
I have a WCF service that I can debug. I put a breakpoint in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.