I have a fresh Azure Mobile Service running locally at localhost:52253. I installed the latest SignalR Nuget Package: Azure Mobile Services .NET Backend SignalR Extension 1.0.450
I also have a test HTML/Javascript client served from localhost:54697/
After working out the CORs issues, I still cannot connect to signalR hubs because the negotiation requests from the SignalR javascript client to the Mobile Service at localhost:52232/signalr/negotiate always result in HTTP/1.1 401 Unauthorized.
I have not enabled any authentication on the server, everything is the default. I also confirmed a WebApi controller works without any authentication. I've also tried decorating the hub and all hub methods with:
[AuthorizeLevel(AuthorizationLevel.Anonymous)]
public class ChatHub : Hub
{
public ApiServices Services { get; set; }
[AuthorizeLevel(AuthorizationLevel.Anonymous)]
public string Send(string message)
{
return "Hello from SignalR Chat Hub!";
}
}
The exact request via fiddler is:
GET http://localhost:52253/signalr/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D&_=1434677053589 HTTP/1.1 Host: localhost:52253 Connection: keep-alive Cache-Control: max-age=0 Accept: text/plain, */*; q=0.01 X-Requested-With: XMLHttpRequest User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36 Content-Type: application/json; charset=UTF-8 Referer: http://localhost:52253 Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8 Cookie: ai_user=09b8290770484a41bec47ce63b379abf|2015-04-01T02:18:46.1194121+00:00; ai_session=ab23831e90cb4773b79353cd4e2963ff|2015-04-28T01:14:18.415Z|2015-04-28T01:52:17.864Z HTTP/1.1 401 Unauthorized Cache-Control: no-cache Pragma: no-cache Expires: -1 Server: Microsoft-IIS/10.0 X-Content-Type-Options: nosniff WWW-Authenticate: Basic realm="Service" X-SourceFiles: =?UTF-8?B?YzpcdXNlcnNca2Fsd2VfMDAwXGRvY3VtZW50c1x2aXN1YWwgc3R1ZGlvIDIwMTNcUHJvamVjdHNcVGVzdFNpZ25hbFIuTW9iaWxlU2VydmljZVxUZXN0U2lnbmFsUi5Nb2JpbGVTZXJ2aWNlXHNpZ25hbHJcbmVnb3RpYXRl?= X-Powered-By: ASP.NET Date: Fri, 19 Jun 2015 04:32:28 GMT Content-Length: 0
The browser then pops up a form asking for basic authentication, but I have no username or password. This is running locally, so there is also no Azure Application Key.
How can I disable or work around this authentication requirement for SignalR hubs on Azure Mobile Services?