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

  • Home
  • SEARCH
  • 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 3597754
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:09:29+00:00 2026-05-18T20:09:29+00:00

My WCF service uses callbacks. To be able to call all clients, I’m using

  • 0

My WCF service uses callbacks. To be able to call all clients, I’m using something like this:

[ServiceBehavior (InstanceContextMode = InstanceContextMode.PerSession)]
class Svc
{
    // stores all connections
    private static List<Svc> Connections = new List<Svc> ();

    // callback for this instance
    private ICallback Cb;

    public Svc ()
    {
        Cb = OperationContext.Current.GetCallbackChannel<ICallback> ();
        Connections.Add (this);
    }

    // ... lots of other code that uses or updates the list of connections
}

Is this the right way to do it?

I’m asking because I’m fighting with an apparent design problem in the above approach. I tried to move a lot of common code, including the static List<Svc> to a common base class that can be used by all my WCF services. But when deriving, this list is shared among all subclasses.

I then tried to avoid this undesirable sharing by making the base class generic (Svc<T>, meaning each subclass gets its own static members) but this leads to other annoyances and is not a clean design.

  • 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-18T20:09:29+00:00Added an answer on May 18, 2026 at 8:09 pm

    Yes, this is the right approach of storing references to your clients to send callbacks to all of them. I don’t store the CallbackChannel objects but the OperationContext instances in my service.

    To your other question: You could extract the code to administrate the list of connected clients to a separate class and use an instance of that class in your service.

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

Sidebar

Related Questions

My WCF service uses callbacks. To be able to call all clients, I'm using
I have a WCF service that I'd like clients to be able to reference
I have a wcf service that uses callbacks with DualHttpBindings. The service pushes back
I have WCF service that uses wsHttpBinding and authentication with certificate. I run this
Using Fiddler I post a JSON message to my WCF service. The service uses
Let's say I have a WCF service that uses the namespace http://mynamespace.com/myservice for all
I have created a WCF routing service. This service uses basicHTTPBinding as it is
I have created a WCF service that uses windows authentication and would like to
I have a WCF service that uses UserName authentication via ACS. This works great
How we could authenticate/authorize WCF RESTful service (that uses webHttpBinding (and not wsHttpBinding, like

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.