Error SignalR Self Hosted Server 500

I recently showed interest in SignalR, but have not yet created a production server, no matter how simple.

I followed the GitHub Self Host documentation but I get a nasty 500 error.

The code I'm using is the following (mostly GitHub code):

class Program { static void Main(string[] args) { string host = "http://localhost:2804"; using (WebApplication.Start<InitialConf>(host)) { Console.WriteLine("Server started on {0}", host); Console.ReadKey(); } } } class InitialConf { public void Configuration(IAppBuilder appBuilder) { var config = new HubConfiguration { EnableCrossDomain = true }; // Map to default /signalr route appBuilder.MapHubs(config); } } class fooHub : Hub { public void DisplayTimeOnServer() { Console.WriteLine(DateTime.Now.ToString()); } } 

Viewing http://localhost:2804/signalr raises error 500:

 HTTP/1.1 500 Internal Server Error Content-Length: 0 Server: Microsoft-HTTPAPI/2.0 

I don't get exceptions / errors in the application, so I'm not sure why it behaves like this.

Anyone have experience with these issues? Or maybe it can lead me to better documentation on this?

thanks

+4
source share
3 answers

The problem is that your hub class is private. Just change it to post.

 public class fooHub : Hub { public void DisplayTimeOnServer() { Console.WriteLine(DateTime.Now.ToString()); } } 
+2
source

Did you try to debug the server?

And you are missing a function / definition in your hub to tell your customers:

 Clients.All.addMessage(message); 

Other that I suggest you check out the following resources:

SignalR Homepage - Tutorial: http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr

Scott Entry: http://www.hanselman.com/blog/AsynchronousScalableWebApplicationsWithRealtimePersistentLongrunningConnectionsWithSignalR.aspx

+1
source

There seems to be a problem setting the route for your connection. After starting your application, you can go to / signalr / hubs and see the details about the hubs.

+1
source

All Articles