User665712185 posted
I have a api app in Azure, i want to add real time notofication, in my client im using angularjs and my code looks like this
var connection = null;
this.initialize = function () {
connection = $.hubConnection("http://name.azurewebsites.net/signalr/hubs", { useDefaultPath: false });
this.proxy = connection.createHubProxy('myHub');
connection.start().done(function () {
console.log("started");
}).fail(function (result) {
console.log(result);
});
};
And in my server im using owin startup, and i have a it confiqured like this
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration {};
hubConfiguration.EnableJSONP = true;
map.RunSignalR(hubConfiguration);
});
and i get this error
XMLHttpRequest cannot load http://name.azurewebsites.net/signalr/hubs/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.