Skip to content
This repository

LongPolling broken on ASP.NET 4.5 #496

Closed
nabils opened this Issue June 28, 2012 · 16 comments

5 participants

Nabil Shuhaiber David Fowler csharmath jmpeltier Sam Thompson
Nabil Shuhaiber
nabils commented June 28, 2012

Using silverlight client version 0.5.2 and the code below invoke is only fired one time. This same code works fine using the standard .net client. This started happening a couple of versions ago.

Thanks,
Nabil

var conn = new HubConnection("http://localhost:55911/");
_hub = conn.CreateProxy("Chat");
_hub.On<string>("AddMessage", message => Deployment.Current.Dispatcher.BeginInvoke(() => Items.Add(message)));

conn.Start().ContinueWith(t =>
{
                    _hub.Invoke("Send", "Hello there from silverlight");
                    _hub.Invoke("Send", "Hello there from silverlight");
                    _hub.Invoke("Send", "Hello there from silverlight");
 });
David Fowler
Owner

Try looking at the requests in fiddler and see if they even make it to the server.
You're also not observing any exceptions, if you call .Wait() on the end, what happens?
Is there a concurrent request limit on Silverlight?

Nabil Shuhaiber
nabils commented June 29, 2012

Silverlight will use the browser network stack by default (mine is IE9). This was working fine in Silverlight a couple of releases ago (some time last week).

They get to the server but the server is not able to call back to the client for the second and third invokes. The first works fine.

Nabil Shuhaiber
nabils commented June 29, 2012

Just noticed in fiddler I am getting the below errors:

POST /signalr/?transport=longPolling&connectionId=4ffb3cb2-a10a-4d9e-8173-a6349be70c89&messageId=2&connectionData=[{"Name":"Chat"}] HTTP/1.1

<!DOCTYPE html>


Object reference not set to an instance of an object.

<br> body {font-family:&quot;Verdana&quot;;font-weight:normal;font-size: .7em;color:black;} <br> p {font-family:&quot;Verdana&quot;;font-weight:normal;color:black;margin-top: -5px}<br> b {font-family:&quot;Verdana&quot;;font-weight:bold;color:black;margin-top: -5px}<br> H1 { font-family:&quot;Verdana&quot;;font-weight:normal;font-size:18pt;color:red }<br> H2 { font-family:&quot;Verdana&quot;;font-weight:normal;font-size:14pt;color:maroon }<br> pre {font-family:&quot;Consolas&quot;,&quot;Lucida Console&quot;,Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}<br> .marker {font-weight: bold; color: black;text-decoration: none;}<br> .version {color: gray;}<br> .error {margin-bottom: 10px;}<br> .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }<br> @media screen and (max-width: 639px) {<br> pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }<br> }<br> @media screen and (max-width: 479px) {<br> pre { width: 280px; }<br> }<br>
<body bgcolor="white">

        <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

        <h2> <i>Object reference not set to an instance of an object.</i> </h2></span>

        <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

        <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

        <br><br>

        <b> Exception Details: </b>System.NullReferenceException: Object reference not set to an instance of an object.<br><br>

        <b>Source Error:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>
                  <code>

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

              </td>
           </tr>
        </table>

        <br>

        <b>Stack Trace:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>
                  <code><pre>

[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.HttpContext.get_CurrentNotification() +48
System.Web.HttpContext.GetWebSocketInitStatus() +40
System.Web.HttpContext.get_IsWebSocketRequest() +28
System.Web.HttpContextWrapper.get_IsWebSocketRequest() +9
SignalR.Hosting.AspNet.AspNetResponse.get_IsClientConnected() +71
SignalR.Transports.TransportDisconnectBase.get_IsAlive() +52
SignalR.Transports.TransportHeartBeat.AddConnection(ITrackingConnection connection) +358
SignalR.Transports.LongPollingTransport.ProcessReceiveRequest(ITransportConnection connection, Action postReceive) +56
SignalR.Transports.LongPollingTransport.ProcessRequest(ITransportConnection connection) +361
SignalR.PersistentConnection.ProcessRequestAsync(HostContext context) +1087
SignalR.Hubs.HubDispatcher.ProcessRequestAsync(HostContext context) +237
SignalR.Hosting.AspNet.AspNetHandler.ProcessRequestAsync(HttpContextBase context) +938
SignalR.Hosting.AspNet.AspNetHandler.ProcessRequestAsync(HttpContext context) +69
System.Web.<>c__DisplayClass1.<System.Web.IHttpAsyncHandler.BeginProcessRequest>b__0() +18
System.Web.TaskAsyncHelper.BeginTask(Func`1 taskFunc, AsyncCallback callback, Object state) +39
System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +77
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +268
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

              </td>
           </tr>
        </table>

        <br>

        <hr width=100% size=1 color=silver>

        <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626

        </font>

</body>

POST /signalr/reconnect?transport=longPolling&connectionId=4ffb3cb2-a10a-4d9e-8173-a6349be70c89&messageId=2&connectionData=[{"Name":"Chat"}] HTTP/1.1

<!DOCTYPE html>


Object reference not set to an instance of an object.

<br> body {font-family:&quot;Verdana&quot;;font-weight:normal;font-size: .7em;color:black;} <br> p {font-family:&quot;Verdana&quot;;font-weight:normal;color:black;margin-top: -5px}<br> b {font-family:&quot;Verdana&quot;;font-weight:bold;color:black;margin-top: -5px}<br> H1 { font-family:&quot;Verdana&quot;;font-weight:normal;font-size:18pt;color:red }<br> H2 { font-family:&quot;Verdana&quot;;font-weight:normal;font-size:14pt;color:maroon }<br> pre {font-family:&quot;Consolas&quot;,&quot;Lucida Console&quot;,Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}<br> .marker {font-weight: bold; color: black;text-decoration: none;}<br> .version {color: gray;}<br> .error {margin-bottom: 10px;}<br> .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }<br> @media screen and (max-width: 639px) {<br> pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }<br> }<br> @media screen and (max-width: 479px) {<br> pre { width: 280px; }<br> }<br>
<body bgcolor="white">

        <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

        <h2> <i>Object reference not set to an instance of an object.</i> </h2></span>

        <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

        <b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

        <br><br>

        <b> Exception Details: </b>System.NullReferenceException: Object reference not set to an instance of an object.<br><br>

        <b>Source Error:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>
                  <code>

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

              </td>
           </tr>
        </table>

        <br>

        <b>Stack Trace:</b> <br><br>

        <table width=100% bgcolor="#ffffcc">
           <tr>
              <td>
                  <code><pre>

[NullReferenceException: Object reference not set to an instance of an object.]
System.Web.HttpContext.get_CurrentNotification() +48
System.Web.HttpContext.GetWebSocketInitStatus() +40
System.Web.HttpContext.get_IsWebSocketRequest() +28
System.Web.HttpContextWrapper.get_IsWebSocketRequest() +9
SignalR.Hosting.AspNet.AspNetResponse.get_IsClientConnected() +71
SignalR.Transports.TransportDisconnectBase.get_IsAlive() +52
SignalR.Transports.TransportHeartBeat.AddConnection(ITrackingConnection connection) +358
SignalR.Transports.LongPollingTransport.ProcessReceiveRequest(ITransportConnection connection, Action postReceive) +56
SignalR.TaskAsyncHelper.Interleave(Func3 before, Func1 after, T arg, TaskCompletionSource1 tcs) +278
SignalR.Transports.LongPollingTransport.ProcessRequest(ITransportConnection connection) +336
SignalR.PersistentConnection.ProcessRequestAsync(HostContext context) +1087
SignalR.Hubs.HubDispatcher.ProcessRequestAsync(HostContext context) +237
SignalR.Hosting.AspNet.AspNetHandler.ProcessRequestAsync(HttpContextBase context) +938
SignalR.Hosting.AspNet.AspNetHandler.ProcessRequestAsync(HttpContext context) +69
System.Web.&lt;&gt;c__DisplayClass1.&lt;System.Web.IHttpAsyncHandler.BeginProcessRequest&gt;b__0() +18
System.Web.TaskAsyncHelper.BeginTask(Func
1 taskFunc, AsyncCallback callback, Object state) +39
System.Web.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +77
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +268
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

              </td>
           </tr>
        </table>

        <br>

        <hr width=100% size=1 color=silver>

        <b>Version Information:</b>&nbsp;Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626

        </font>

</body>

David Fowler
Owner

Try using IIS express.

Nabil Shuhaiber
nabils commented June 29, 2012
Nabil Shuhaiber
nabils commented June 29, 2012

Even tried IIS (windows 7) and no luck with that either. This has to be easily reproducible. Don't think I am doing anything wrong. I have checked a number of times.

csharmath

where is your repo ?

Nabil Shuhaiber
nabils commented June 30, 2012
David Fowler
Owner

I'll try to repro and make a fix for 0.5.3 when I do. VS2012 on a .NET 4.0 application or .NET 4.5?

David Fowler davidfowl closed this in 77ef3df June 30, 2012
Nabil Shuhaiber
nabils commented July 01, 2012
David Fowler
Owner

It's fixed in master

Nabil Shuhaiber
nabils commented July 03, 2012
jmpeltier

I saw this happen to me as well in 0.5.2 so I am glad a fix is on the way. I am using VS 2012 RC and .NET 4.5. I first noticed it when one of my Firefox browsers (v 13) decided to connect via Long polling instead of serverSentEvents. Not sure why it auto connected as long polling but it did. So of course I have to ask.... Any idea when 0.5.3 will be release ? :)

David Fowler
Owner
jmpeltier

No problem I understand. Like they say it never hurts to ask.

Sam Thompson

0.5.3 fixed this for me as well. It took me a while to find this thread when I searched on "signalr network error 500", so adding that tag here. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.