Note that there are some explanatory texts on larger screens.

plurals
  1. POSignalR - The connection id is in the incorrect format when using Windows and Anonymous authentication
    text
    copied!<p>I use SignalR 1.0.1 as a chat core for ASP.NET MVC3 application. Using IIS 7.5<br/><br/> There are two methods in MVC controller which provides access to chat views:<br/> 1. First method is public, allowing anonymous users to chat - no authorization.<br/> 2. Access to second method is restricted with <code>[Authorize]</code> attribute, for domain users - chat agents.<br/><br/> There is no explicitly specified authorization in the Hub.<br/> For this scenario I involved both Windows and Anonymous authentication on IIS.<br/><br/> I also implemented custom Role Provider, which operates only in memory - not persisting anything to database. </p> <p>What happens is that using '[Authorize]' attribute in controller method leads to responsing 500 from Hub, both when call is coming from authorized view, and the anonymous one:</p> <p>Request (<code>send</code> is Hub method for sending messages):<br/><br/> <code>http://localhost:8101/signalr/send?transport=serverSentEvents&amp;connectionToken=VIXEZzWQSn5SNlA8RUy4iaOPDFdvuPBjMvFBiG2FLfvfxF347XHwtapsEV5ndU4OEI0Xb64W2ZRXTqwBiL2CXg2_JlTaTJ2RnVOj4bjvx6tQaYhAqTaXs9k2853GYqzd0</code></p> <p>Response:<br/><br/> <code>The connection id is in the incorrect format.</code></p> <pre><code>Server stack trace: at Microsoft.AspNet.SignalR.PersistentConnection.GetConnectionId(HostContext context, String connectionToken) at Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequest(HostContext context) at Microsoft.AspNet.SignalR.Owin.CallHandler.Invoke(IDictionary2 environment) at Microsoft.AspNet.SignalR.Owin.Handlers.HubDispatcherHandler.Invoke(IDictionary2 environment) at Microsoft.Owin.Host.SystemWeb.OwinCallContext.Execute() at Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object extraData)&lt;br/&gt;&lt;br/&gt; </code></pre> <p>But notice, that connecting to Hub works fine, returns 200 OK:<br/> <code>http://localhost:8101/signalr/connect?transport=serverSentEvents&amp;connectionToken=dYOwFxa1mkgdpzw-jitRpWq9oxRlrTet8U_dAzWjFQEdGNJfVXeG7Op0NZZwvznxeNdJCuPT75CKzQqI9HRPThV3uEDt-Z2qtIl9E02gF481&amp;connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D&amp;tid=9</code><br/></p> <p>I found little similiar thread here on stackoverflow:<br/> <a href="https://stackoverflow.com/questions/15349043/signalr-the-connection-id-is-in-the-incorrect-format">signalr The connection id is in the incorrect format</a></p> <p><br/> from which I understand, that when invoking my <code>Send</code> method, the Hub is processing request with <code>Identity</code> different than the one used to connect to Hub, OR Hub's <code>GetConnectionId</code> finds, that user is actually not authorized - but how it checks that assumption, when there is no authorization specified on the Hub itself? <br/><br/></p> <p>Can someone put some light on this?</p> <p>Thanks in advance :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload