gpt4 book ai didi

iis-7 - Windows Server 2008 上的 SignalR serverSentEvents 和 IIS 7 POST 请求需要太多时间才能完成

转载 作者:行者123 更新时间:2023-12-04 02:50:57 25 4
gpt4 key购买 nike

我正在使用 SignalR 2.0.0-beta2 它在生产环境中表现异常 ASP.NET MVC 5 [ .NET Framework 4.5 ] 应用程序安装在 Windows Server 2008IIS 7 . AppPool 处于集成模式并且只有这个应用程序。

GET SignalR 提出的要求仅需 60 毫秒:

http://mysite.org.br/signalr/negotiate?clientProtocol=1.3&_=1374377239338

问题发生在 POST 上需要永远的请求。在最近的测试中,它花费了难以置信的 3m 1s:

http://mysite.org.br/signalr/send?transport=serverSentEvents&connectionToken=Lp%2BGdI6jVTLPrQ3ZGJ065F9GrMbKYWNmgrtKPZz%2BCUYAsxrqP7hyAMPr%2Bg1E3IRY%2F0brzXVanumPy7NPCFOlcXTRrJssFD2EEoxd6fWhAVEUSfIj

当这种间歇性问题发生时,通常需要 40 秒 才能完成请求。

Firefox 22 测试它和 Firebug...如果我禁用浏览器缓存,它会顺利运行,也就是说,它不会延迟 POST要求。否则,当我启用浏览器缓存时,它会再次延迟 POST请求。

使用 Google Chrome 28 POST 处于pending 状态。

如果我回收 AppPool , 然后是 POST请求仅需 203 毫秒。我对这个特定的 AppPool 所做的唯一修改是我设置的 Idle Time-out (minutes) = 0 ,也就是说,我想避免回收 AppPool。

查看 Process Explorer 我看到了 w3wp.exe 177.300 KB (Private Bytes)211.900 (Working Set)CPU0现在。

这是 SignalR从 Firebug 控制台获取的日志信息:

[00:27:20 GMT-0300] SignalR: Negotiating with '/signalr/negotiate?clientProtocol=1.3'.
Signal...FCU9MU1 (line 1)
GET http://mysiste.org.br/signalr/negotiate?clientProtocol=1.3&_=1374377239338 200 OK 62ms
js?v=K...xUBM641 (line 1)
[00:27:20 GMT-0300] SignalR: Attempting to connect to SSE endpoint 'http://mysiste.org.br/signalr/connect?transport=serverSentEvents&connectionToken=Lp%2BGdI6jVTLPrQ3ZGJ065F9GrMbKYWNmgrtKPZz%2BCUYAsxrqP7hyAMPr%2Bg1E3IRY%2F0brzXVanumPy7NPCFOlcXTRrJssFD2EEoxd6fWhAVEUSfIj&connectionData=%5B%7B%22name%22%3A%22assessmenthub%22%7D%5D&tid=5'
Signal...FCU9MU1 (line 1)
[00:27:20 GMT-0300] SignalR: EventSource connected
Signal...FCU9MU1 (line 1)
[00:27:20 GMT-0300] SignalR: Now monitoring keep alive with a warning timeout of 13333.333333333332 and a connection lost timeout of 20000
Signal...FCU9MU1 (line 1)
POST http://mysiste.org.br/signalr/send?transport=s...F0brzXVanumPy7NPCFOlcXTRrJssFD2EEoxd6fWhAVEUSfIj 200 OK 3m 1s
js?v=K...xUBM641 (line 1)
[00:39:12 GMT-0300] SignalR: EventSource readyState: 0
Signal...FCU9MU1 (line 1)
[00:39:12 GMT-0300] SignalR: EventSource reconnecting due to the server connection ending
Signal...FCU9MU1 (line 1)
[00:39:14 GMT-0300] SignalR: EventSource calling close()
Signal...FCU9MU1 (line 1)
[00:39:14 GMT-0300] SignalR: serverSentEvents reconnecting
Signal...FCU9MU1 (line 1)
[00:39:14 GMT-0300] SignalR: Attempting to connect to SSE endpoint 'http://mysiste.org.br/signalr/reconnect?transport=serverSentEvents&connectionToken=Lp%2BGdI6jVTLPrQ3ZGJ065F9GrMbKYWNmgrtKPZz%2BCUYAsxrqP7hyAMPr%2Bg1E3IRY%2F0brzXVanumPy7NPCFOlcXTRrJssFD2EEoxd6fWhAVEUSfIj&connectionData=%5B%7B%22name%22%3A%22assessmenthub%22%7D%5D&messageId=d-k%2C0%7Cx%2C0%7Cy%2C1%7Cz%2C0&tid=5'
Signal...FCU9MU1 (line 1)
[00:39:44 GMT-0300] SignalR: Couldn't reconnect within the configured timeout (30000ms), disconnecting.
Signal...FCU9MU1 (line 1)
[00:39:44 GMT-0300] SignalR: SignalR: Stopping connection.

我的 Web.config有这些设置:

<system.web>
.
.
.
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
</system.web>

<system.webServer>
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="false" />
<validation validateIntegratedModeConfiguration="false" />
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
</staticContent>
<modules runAllManagedModulesForAllRequests="true">
<add name="PerRequestLifestyle" type="Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule, Castle.Windsor" />
</modules>
<handlers>
<add name="AttributeRouting" path="routes.axd" verb="*" type="AttributeRouting.Web.Logging.LogRoutesHandler, AttributeRouting.Web" />
</handlers>
<security>
<requestFiltering>
<requestLimits maxQueryString="10240"></requestLimits>
</requestFiltering>
</security>
</system.webServer>

从症状看来,响应正在以某种方式被缓冲。这SignalR issue提到 AVG 防病毒软件是问题所在,但我的客户端服务器上没有安装 AVG 防病毒软件。它有 McAfee虽然。

是什么导致了这种行为?如果您需要更多信息来帮助进一步调试,请直接询问,我会尽力提供。


注意:与此同时,我恢复到 SignalR 稳定版本 1.1.2,到目前为止一切正常。

最佳答案

只是为了让将来可能会发现此问题的每个人都清楚这一点:

问题与 SessionState 有关在 ASP.NET 中使用。作为@dfowler说:

Using session with SignalR won't work at all. It'll make all requests take the session lock and that's likely why you're seeing these problems.

因此,解决方案是:删除 <sessionState>从你的 Web.config 配置文件和您可能在 Global.asax 中拥有的任何 session 事件.

<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>

摆脱它后,我的问题就解决了。


我必须更新到 SignalR 2.0.0真正解决问题。

关于iis-7 - Windows Server 2008 上的 SignalR serverSentEvents 和 IIS 7 POST 请求需要太多时间才能完成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17768838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com