I'm working on an app, my server run on Azure platform as Api App, i want to use signalR i get this error
XMLHttpRequest cannot load http://sitename.net/signalr/negotiate?clientProtocol=1.5&connectionData=%5B%5D&_=1501957673711. The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. Origin 'http://localhost:35609' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
Im my server im using owin startup, and here is the config
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration {};
hubConfiguration.EnableJSONP = true;
map.RunSignalR(hubConfiguration);
});
and in my webConfig i tried this
var cors = new EnableCorsAttribute("*", "*", "*")
{
SupportsCredentials = true
};
config.EnableCors(cors);
But it doesn't solve the error. If any one has an idea what im missing please help.. Thanks
in my client im using angularjs like this
var connection = null;
this.initialize = function () {
connection = $.hubConnection("http://name.azurewebsites.net/signalr"{ useDefaultPath: false });
this.proxy = connection.createHubProxy('myHub');
connection.start().done(function () {
console.log("started");
}).fail(function (result) {
console.log(result);
});
};
And in my azure api app i have added my local domain to the allowed CORS. i can do other things but i cant use signalR