1
votes

I am in the process of upgrading to RC2 from RC1. I have used a new working project and am moving my code over to this container.

I have a CSV file download section for which I use SignalR to send back to the browser where the download and processing is up to. I moved the code over and I am getting the following error on the page:

An unhandled exception occurred while processing the request.
InvalidOperationException: 'ProgressHub' Hub could not be resolved.

Microsoft.AspNetCore.SignalR.Hubs.HubManagerExtensions.EnsureHub(IHubManager hubManager, String hubName, IPerformanceCounter[] counters)

Stack Query Cookies Headers 

InvalidOperationException: 'ProgressHub' Hub could not be resolved.
    Microsoft.AspNetCore.SignalR.Hubs.HubManagerExtensions.EnsureHub(IHubManager hubManager, String hubName, IPerformanceCounter[] counters)
    Microsoft.AspNetCore.SignalR.Infrastructure.ConnectionManager.GetHubContext(String hubName)
    Microsoft.AspNetCore.SignalR.Hubs.HubContextService`1..ctor(IConnectionManager connectionManager)
    --- End of stack trace from previous location where exception was thrown ---

This kind of error has been asked on Stackoverflow before specifically here and I have looked here but nothing specifically about a hub not being resolved.

I followed the process laid out here by Konda.si

In project.json i have the following dependency:

    "Microsoft.AspNetCore.SignalR.Server": "0.1.0-rc2-20896",

I have added the service to Startup.cs ConfigureServices...

     services.AddSignalR();

and to Configure.. I have added:

    app.UseSignalR();

I have added the requisite signalr jquery.. but it never gets there folding on the fact that Hub could not be resolved.

and this is my hub:

using Microsoft.AspNetCore.SignalR;

namespace JobsLedger.Hubs
{
    public class ProgressHub : Hub
    {
    }
}

How can I fix this error?

EDIT: Just created a vanilla project added in the dependency, the hub, and in the homecontroller I simply used dependency injection to inject hub and I got the same error.. is there something else I need to do for RC2?

EDIT: So I removed the dependency injection of the hub into the service. The page now loads. ...and the connection with the hub is made so signalr is installed correctly but its the Dependency Injection that is failing..

1
It is highly recommended to wait for official SignalR Core in .NET Core 1.1 phase. You trouble yourself so much before the product is ready for even testing.Lex Li
If you really need to use SignalR with RC2 this is what you need to do: github.com/aspnet/SignalR-Server/issues/…Pawel

1 Answers

1
votes

Buggered me for a while this. Instead of placing the error heading and searching on that I, instead, put the following in:

Microsoft.AspNetCore.SignalR.Hubs.HubManagerExtensions.EnsureHub(IHubManager hubManager, String hubName, IPerformanceCounter[] counters)

Found an answer on Github in SignalR here.

I suspected there was a problem with the package and I figured I would just ride it out and wait until they matured it. Turns out they have already made available the signalr RC2-final dependency:

    "Microsoft.AspNetCore.SignalR.Server": "0.1.0-rc2-final",

I got the answer from a post by Kagamine towards the bottom of the issue. Here is what he had to say:

I have created a feed which includes SignalR.Server rc2 & SignalR.Client. You can add this into NuGet.config:

<add key="Code Comb" value="https://www.myget.org/F/codecomb-rc2/api/v3/index.json" />

Put this into project.json:

"Microsoft.AspNetCore.SignalR.Server" : "0.1.0-rc2-final"

This package which on myget has been fixed the Issue #164.

Basically I changed over the dependency and added the key to the global nuget.config file and that fixed the problem with the dependency injection for me.