I'm trying to make some self hosted SignalR app(Console). But it is not working with Asp.Net MVC 5, i was searched everything. I was working with this literally 1 day but still it is not working.
I'm using SignalR 2.4.1 both on console and web side.
The startup code on console app is;
class startup
{
public void Configuration(IAppBuilder app)
{
var hubConfiguration = new HubConfiguration();
hubConfiguration.EnableDetailedErrors = true;
hubConfiguration.EnableJSONP = true;
HubException exception = new HubException();
//app.UseCors(CorsOptions.AllowAll);
app.MapSignalR(hubConfiguration);
Console.WriteLine("hub started");
}
}
On console main;
class Program
{
static void Main(string[] args)
{
string url = @"http://localhost:5693";
var web = WebApp.Start<startup>(url);
Console.ReadLine();
}
}
The Test Hub is;
public class testHub : Hub
{
public void hopeWorks()
{
Console.WriteLine("called");
Clients.All.Work();
Clients.Caller.Work();
}
}
On the Client side is Javascript like that;
$.connection.hub.start().done(function () {
console.log("socket started");
});
I was attached the message sending code to button but it didnt work, so i'm trying on console. I'm trying to call it from dev tools, and it is
$.connection.testHub.server.hopeWorks();
and nothing happens like the image shows.
I dont know what should i try else, i tried like everything. Searched on google and gone thru next pages.
Sorry for the english btw.