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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:54:40+00:00 2026-05-31T07:54:40+00:00

I am trying to set SignalR up, but I keep getting the following error

  • 0

I am trying to set SignalR up, but I keep getting the following error when adding a message:

“Cannot perform runtime binding on a null reference”

My ClientSide code looks like this:

commentHub.addMessage = function (message) {
    $('#divMessages').append(message);
};

And my serverside code looks like this:

public void Send(string message)
{
     Clients.addMessage(message);
}

I first open one window where the client side code is at, and then I open a new page which invokes the Send method from codebehind. To test it out, I simply invoke the send Method like this:

protected override void OnPreRender(EventArgs e)
{
    base.OnPreRender(e);
    new TestHub().Send("Test");
}

I first thought that the error came from a call in the wrong place in the page cycle, so I moved it from OnInit to PreRender, but I stil receive the error. Now I am wondering if I have to execute the Send command from Client side to get it updated?

  • 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-31T07:54:42+00:00Added an answer on May 31, 2026 at 7:54 am

    If I understand correctly you want to invoke the client method from the server. The issue is that the server is a hub which is basically just a service. You could try to do as @sinanakyazici suggests however this is not a typical interaction.

    If your goal is to notify connected clients of some server event then you can follow the doc here (https://github.com/SignalR/SignalR/wiki/Hubs), in the last section called "Broadcasting over a Hub from outside of a Hub". Please note that during the page lifecycle, the user is NOT connected to the hub as the page is refreshing. It is only after the page loads and the javascript $.connection.start() method is invoked that the user is connected. Even if you were to send a message through the hub, the user who caused the page refresh will not receive that message. That said there are times when you want to send a message from code behind to other users, that can be accomplished as mentioned by following the wiki and looks like:

    using SignalR.Infrastructure;
    
    IConnectionManager connectionManager = AspNetHost.DependencyResolver.Resolve<IConnectionManager>();
    dynamic clients = connectionManager.GetClients<MyHub>();
    // invoke javascript method for all connected clients
    clients.addMessage("Your message here");
    

    For your specific requirement it sounds like you want the caller to get feedback as to the status of some long running task. This is where you would typically invoke the hub from the client side and the hub would then report back progress reports until complete at which point it could fire a completed callback. Typically this is done using the following:

    public void SomeTask(string message)
    {
         dowork();
         // send message only to the invoker
         Caller.addMessage("50% complete");
         domorework();
         // send message only to the invoker
         Caller.addMessage("100% complete");
         // fire processComplete javascript function
         Caller.processComplete();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When trying to set DoMatchParen I get the following error: E492: Not an editor
I'm trying to set up a basic threaded class in C++, but I'm getting
I am trying to set up Ninject with SignalR in a console application but
Hi I am trying to set up signalR to distribute messages to web users
I'm using SignalR 0.5.2 and I'm trying to get a DependencyResolver set up using
Im trying set the single table inheritance model type in a form. So i
Trying to set up a self signed certificate, for our intranet's web services site.
Trying to set it so if a certain condition is met then one of
Trying to set up a dependency in C++ with a parent-child relationship. The parent
Trying to set up a new project, and running into a weird issue. I

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.