SignalR/SignalR — Issue #41: Protcol error: Missing client id.
Author: davideweaver
Created: 2011-10-12 22:06:13+00:00
State: open

I have an ASP.NET MVC app hosting the chat sample (as seen on Hanselmann's blog post) which works great. I have another ASP.NET webforms app that get ~5 requests per second. The webforms app is using the Signalr client from the code behind and does a Connection.Send(msg) to the chat server when a request is received.

99% of the time it works correctly, then I get the following exception on the webforms app:

```javascript

Application ID: DefaultDomain

Process ID: 4520

Exception: System.Runtime.Serialization.SerializationException

Message: Type 'Newtonsoft.Json.JsonReaderException' in Assembly 'Newtonsoft.Json, Version=4.0.2.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' is not marked as serializable.

StackTrace: at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeObject(Object obj, MemoryStream stm)
at System.AppDomain.Serialize(Object o)
at System.AppDomain.MarshalObject(Object o)
```

which I think is coming from a thread spawned by the Signalr client. I then get the following unhandled exception from the MVC chat server:

```javascript
Protcol error: Missing client id.

Stack Trace

[System.InvalidOperationException: Protcol error: Missing client id.]
at SignalR.PersistentConnection.ProcessRequestAsync(HttpContext context)
at SignalR.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
```

The exception on the chat server happens for a couple minutes, then the webforms app crashes w3wp.exe. I iisreset the webforms app and it works for another hour or so then happens again.