It could be configuration mistake in your server configuration. I would suggest that you install the server and use Windows as authentication pattern, allow HTTP and in the websocket origin white list add the IP-address for the computer or the hole domain by yourdomain.com and this code should work.
var location = Location.FromUri(new Uri("http://yourserver.com));
using (var hub = location.Hub(noVersionCheck:true))
foreach (var appId in location.GetAppIdentifiers())