I recently updated the project from SignalR 2.0.0-beta1 to 2.0.0-rc1. I understand that cross-domain request support configuration has changed in RC1. I updated my project to use the new syntax, but now I get the following error when trying to contact my center:
XMLHttpRequest cannot load = 1377623738064 "> HTTP: // local: 8080 / negotiates connectionData =% 5B% 7B% 22name% 22% 3A% 22chathub% 22% 7D% 5D & ClientProtocol = 1.3 & = 1377623738064 ?. Origin http://localhost:7176 not allowed Access-Control-Allow-Origin.
The client site runs at http://localhost:7176 , and the hub listens on the console application at http://localhost:8080 . Am I missing something? Cross domain requests worked before my upgrade to RC1.
CONSOLE APP ENTRANCE POINT
static void Main(string[] args) { var chatServer = new ChatServer(); string endpoint = "http://localhost:8080"; chatServer.Start(endpoint); Console.WriteLine("Chat server listening at {0}...", endpoint); Console.ReadLine(); }
CHATSERVER CLASS
public class ChatServer { public IDisposable Start(string url) { return WebApp.Start<Startup>(url); } }
STARTUP CONFIGURATION
public class Startup { public void Configuration(IAppBuilder app) { app.Map("/signalr", map => { map.UseCors(CorsOptions.AllowAll); map.RunSignalR(new HubConfiguration { EnableJSONP = true }); }); } }
Scott source share