I am new to both ASP.NET MVC and Signalr. I am following this tutorial to learn SQL interaction with ASP>NET via signalr.
I have tried below steps
- Created a new Project "ASP.NET MVC3"
- Selected Internet application with razor view engine.
- Installed Microsoft ASP.NET signalr via nuget
- Created the same database and same table.
- Modified my webconfig by adding the connectionstring.
- Applied Changes in the Global.asax to enable & stop listner.
- Added a class "JobInfo" - similar to step 5 in the link.
- On step 7 of the tutorial when I click on project > add new item , I didn't find Signalr hub class. So I added a normal class with the same name
Code
namespace MvcApplication1
{
public class JobHub
{
public static void Show()
{
IHubContext context = GlobalHost.ConnectionManager.GetHubContext<JobHub>();
context.Clients.All.displayStatus();
}
}
}
Now, when I am building my solution I am getting this error
The type 'MvcApplication1.JobHub' cannot be used as type parameter 'T' in the generic type or method 'Microsoft.AspNet.SignalR.Infrastructure.IConnectionManager.GetHubContext<T>()'.
There is no implicit reference conversion from 'MvcApplication1.JobHub' to 'Microsoft.AspNet.SignalR.Hubs.IHub'.
Also, I am not sure how to implement step 8 because when I clicked on controller to add "valueController" I am not able to inherit it from "ApiController".
Below is the screen shot of my application.
How can I fix this?

public class JobHub : IHubor something along those lines. It seems like you should be inheriting there.