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 6804329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:27:08+00:00 2026-05-26T19:27:08+00:00

I use a PollingDuplexHttpBinding so that clients can exchange messages in my application. Clients

  • 0

I use a PollingDuplexHttpBinding so that clients can exchange messages in my application.
Clients are registers via a RegisterClient() method that adds them to a static dictionary for future use.

The code looks like this:

[ServiceContract(Namespace = "...", CallbackContract = typeof(MyServiceCallback))]
public class MyService
{
    public static Dictionary<string, MyServiceCallback> Clients =
        new Dictionary<string, MyServiceCallback>();

    [OperationContract]
    public void RegisterClient(string name)
    {
        Clients[name] =
            OperationContext.Current.GetCallbackChannel<MyServiceCallback>();
    }

    public static void SendMessage(string name, string message)
    {
        Clients[name].SendMessage(message);
    }
}

[ServiceContract]
public interface MyServiceCallback
{
    [OperationContract(IsOneWay = true)]
    void SendMessage(string message);
}

Everything works well except when the application pool gets recycled.

Of course I realize that the static stuff is not ideal in that regard.

Where would be a good place to save my client references so that they survive an app pool recyle?

  • 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-26T19:27:09+00:00Added an answer on May 26, 2026 at 7:27 pm

    I don’t think you can make themn survive an app pool recycle since for that you would need to persist and recreate the Channels…

    A better approach would be IMHO to host your WCF service in a Windows Service (no app pool recycling) for this kind of stuff…

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

Sidebar

Related Questions

Use scenario is pretty simple: I have a desktop only application that could be
Use case: 3rd party application wants to programatically monitor a text file being generated
use Rack::Static, :urls => ['/stylesheets', '/images'], :root => 'public' run proc { |env| [200,
We use a data acquisition card to take readings from a device that increases
Use the static modifier to declare a static member, which belongs to the type
use javascript or other method ? have any recommendation?
use case example I have a servlet that is receiving login requests. If a
Is it a good idea to use PollingDuplexHttpBinding with Silverlight in conjunction with the
can I use ServiceReference.config file for configuring PullingDuplexHttpBinding? If yes, please tell me how.
Use OPENXML to get dt element in MSSQL 2005. How can I get xmlns:dt

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.