Here is the page:
<script src="~/Scripts/jquery-1.10.2.min.js"></script> <script src="~/Scripts/jquery.signalR-2.1.2.min.js"></script> <script src="~/signalr/hubs"></script> <script> $(function () { </script>
Here is the hub class:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR.Hubs; namespace AdminWebApp.Hubs { [HubName("notificationHub")] public class NotificationHub : Hub { public void SendNotification(string message) { Clients.All.addNewMessage(message); } } }
Startup.cs:
using Microsoft.Owin; using Owin; [assembly: OwinStartupAttribute(typeof(AdminWebApp.Startup))] namespace AdminWebApp { public partial class Startup { public void Configuration(IAppBuilder app) { ConfigureAuth(app); } } }
When I try to access: http://localhost:4551/signalr/hubs I get an HTTP 404 error not found, and when I try to start the page, I get:
Failed to load resource: the server responded with a status of 404 (Not Found) Uncaught TypeError: Cannot read property 'client' of undefined
I tried this: signalR: / signalr / hubs is not generated and it did not work.
Any ideas?
source share