locked
RuntimeBinder Exception Happens calling SignalR Hub method on ASP.NET RRS feed

  • Question

  • User440194289 posted

    Hi,

    I'm in trouble when I run project like following.

    1) Create ASP.NET Web App project with Web API checking

    2) Add Hubs folder

    3) Add SignalR Hub class. Name of the class is "TestHub"

    4) Add TestSRController class in the Controllers folder using controller scaffolding 'Web API 2 empty' and add following a method.

    public void Get()
    {
        var context = GlobalHost.ConnectionManager.GetHubContext<Hubs.TestHub>();
        if (context != null)
        {
             context.Clients.All.Hello();
        }
    }

    I set breakpoint at line of "var context = ..." then run this project in Internet Explorer and access "http://.../api/TestSR" and execute this method step by step.
    When "context.Clients.All.Hello()" is executed then "Microsoft.CSharp.RuntimeBinder.RuntimeBinderException" happens.

    It seems that framework can't find Hello method in TestHub.

    I confirmed this code worked successful on early version but don't work version 2.0.0.

    Are there any change around SignlR framework at the time of version up?

    If I should change some code or setting please let me know

    Wednesday, March 25, 2015 8:58 PM

Answers