LongPolling broken on ASP.NET 4.5 #496

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

Projects

None yet

5 participants

@nabils
nabils commented Jun 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");
 });
@davidfowl
Member

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?

@nabils
nabils commented Jun 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.

@nabils
nabils commented Jun 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

<title>Object reference not set to an instance of an object.</title> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } @media screen and (max-width: 639px) { pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } } @media screen and (max-width: 479px) { pre { width: 280px; } } </style>
<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

<title>Object reference not set to an instance of an object.</title> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } @media screen and (max-width: 639px) { pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; } } @media screen and (max-width: 479px) { pre { width: 280px; } } </style>
<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(Func1 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>
@davidfowl
Member

Try using IIS express.

@davidfowl davidfowl was assigned Jun 29, 2012
@nabils
nabils commented Jun 29, 2012

I am using IIS express. Can you not reproduce it?

On 29 Jun 2012, at 10:17, David Fowler
reply@reply.github.com
wrote:

Try using IIS express.


Reply to this email directly or view it on GitHub:
#496 (comment)

@nabils
nabils commented Jun 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 ?

@nabils
nabils commented Jun 30, 2012

It was only a few of lines of code to repro which I posted above. If
you need a full repro solution let me know and I should be able to
post in a couple of days as I am travelling at the moment.

On 30 Jun 2012, at 03:29,
reply@reply.github.com
wrote:

where is your repo ?


Reply to this email directly or view it on GitHub:
#496 (comment)

@davidfowl
Member

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?

@davidfowl davidfowl closed this in 77ef3df Jul 1, 2012
@nabils
nabils commented Jul 1, 2012

VS2012 with silverlight 4. It works using .net 4 application.

Thanks

On 1 Jul 2012, at 00:48, David Fowler
reply@reply.github.com
wrote:

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?


Reply to this email directly or view it on GitHub:
#496 (comment)

@davidfowl
Member

It's fixed in master

@nabils
nabils commented Jul 3, 2012

Working perfectly now. Thanks a lot.

On 1 July 2012 18:02, David Fowler <
reply@reply.github.com

wrote:

It's fixed in master


Reply to this email directly or view it on GitHub:
#496 (comment)

Best Regards,
Nabil Shuhaiber

@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 ? :)

@davidfowl
Member

When it's released. If you need it now build from source.

Sent from my Windows Phone
From: jmpeltier
Sent: 7/9/2012 9:36 AM
To: David Fowler
Subject: Re: [SignalR] LongPolling broken on ASP.NET 4.5 (#496)
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 ? :)


Reply to this email directly or view it on GitHub:
#496 (comment)

@jmpeltier

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

@samtny
samtny commented Aug 8, 2012

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