从Visual Studio运行一段时间后,SignalR连接会自动停止

时间:2012-04-24 15:01:14

标签: signalr

我有一个网页,使用SignalR在JqGrid中显示最新的数据集。每当数据被修改时,所有连接的客户端都会使用更新的数据重新加载jQGrid。

一切正常,但我注意到页面在一段时间后,即一分钟左右后停止刷新数据。并且浏览器中的状态栏保持非常快速且几乎每秒都运行。如果我通过执行F5刷新页面,则网格开始刷新数据但在一段时间后停止。

此外我已经意识到,无论我在ReconnectionTimeout参数中设置什么值,我的网格都只刷新数据,然后停止。

ReconnctionTimeOut我的建议如下:

var config = AspNetHost.DependencyResolver.Resolve<IConfigurationManager>();
            config.ReconnectionTimeout = TimeSpan.FromSeconds(60);

在这种情况下,我的页面只刷新数据60秒然后停止。我尝试将其设置为0,假设它将永远刷新页面,但在这种情况下网格刷新几乎立即刷新。我正在使用IE8浏览器。请让我知道如何让它永远运行?


来自小提琴手的堆栈追踪 - 错误从此请求开始

GET http://localhost.:2629/AlarmPoc/signalr?transport=foreverFrame&connectionId=600dda9b-225f-42ef-a8f3-79008bf6faaf&connectionData=%5B%7B%22name%22%3A%22YW.AlarmPoC.Web.SignalR.AlarmHub%22%2C%22methods%22%3A%5B%22notification%22%5D%7D%5D&messageId=2&frameId=1
302 Found to /AlarmPoc/signalr/

对上述请求的回复

HTTP/1.1 302 Found
Server: ASP.NET Development Server/10.0.0.0
Date: Mon, 30 Apr 2012 13:05:00 GMT
Content-Length: 135
Location: /AlarmPoc/signalr/
Connection: Close

<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href='/AlarmPoc/signalr/'>here</a>.</h2>
</body></html>

下一个请求

GET http://localhost.:2629/AlarmPoc/signalr/
500 Internal Server Error (text/html)

响应

HTTP/1.1 500 Internal Server Error
Server: ASP.NET Development Server/10.0.0.0
Date: Mon, 30 Apr 2012 13:05:00 GMT
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: text/html; charset=utf-8
Connection: Close

<html>
    <head>
        <title>Unknown transport.</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:"Lucida Console";font-size: .9em}
         .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; }
        </style>
    </head>

    <body bgcolor="white">

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

            <h2> <i>Unknown transport.</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.InvalidOperationException: Unknown transport.<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.</code>

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

            <br>

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

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

[InvalidOperationException: Unknown transport.]
   SignalR.PersistentConnection.ProcessRequestAsync(HostContext context) +329
   SignalR.Hubs.HubDispatcher.ProcessRequestAsync(HostContext context) +203
   SignalR.Hosting.AspNet.AspNetHost.ProcessRequestAsync(HttpContextBase context) +433
   SignalR.Hosting.AspNet.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +125
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8967220
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +184
</pre></code>

                  </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.272

            </font>

    </body>
</html>
<!-- 
[InvalidOperationException]: Unknown transport.
   at SignalR.PersistentConnection.ProcessRequestAsync(HostContext context)
   at SignalR.Hubs.HubDispatcher.ProcessRequestAsync(HostContext context)
   at SignalR.Hosting.AspNet.AspNetHost.ProcessRequestAsync(HttpContextBase context)
   at SignalR.Hosting.AspNet.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)
-->

0 个答案:

没有答案