在IIS中托管时,SignalR回调未触发

时间:2013-11-22 20:39:14

标签: iis-7.5 signalr

我正在使用SignalR 2.0和MVC5 here的聊天演示。我添加了一个NServiceBus背板,在IISExpress中一切正常。

但是,当我在Windows 7上的IIS 7.5中托管时,我的客户端回调没有触发。我打开了客户端登录,这是日志:

[14:13:42 GMT-0600 (Central Standard Time)] SignalR: Client subscribed to hub 'chathub'. jquery.signalR-2.0.0.min.js:8
[14:13:42 GMT-0600 (Central Standard Time)] SignalR: Negotiating with '/signalr/negotiate?connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D&clientProtocol=1.3'. jquery.signalR-2.0.0.min.js:8

[14:13:42 GMT-0600 (Central Standard Time)] SignalR: Attempting to connect to SSE endpoint 'http://localhost:8020/signalr/connect?transport=serverSentEvents&connection…z5pLeBNULTyEhm&connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D&tid=2'. jquery.signalR-2.0.0.min.js:8

[14:13:42 GMT-0600 (Central Standard Time)] SignalR: EventSource connected. jquery.signalR-2.0.0.min.js:8

[14:13:47 GMT-0600 (Central Standard Time)] SignalR: serverSentEvents timed out when trying to connect. jquery.signalR-2.0.0.min.js:8

[14:13:47 GMT-0600 (Central Standard Time)] SignalR: EventSource calling close(). jquery.signalR-2.0.0.min.js:8

[14:13:47 GMT-0600 (Central Standard Time)] SignalR: This browser supports SSE, skipping Forever Frame. jquery.signalR-2.0.0.min.js:8

[14:13:47 GMT-0600 (Central Standard Time)] SignalR: Opening long polling request to 'http://localhost:8020/signalr/connect?transport=longPolling&connectionToken…z5pLeBNULTyEhm&connectionData=%5B%7B%22name%22%3A%22chathub%22%7D%5D&tid=5'. jquery.signalR-2.0.0.min.js:8

[14:13:52 GMT-0600 (Central Standard Time)] SignalR: longPolling timed out when trying to connect. jquery.signalR-2.0.0.min.js:8

[14:13:52 GMT-0600 (Central Standard Time)] SignalR: Aborted xhr request. jquery.signalR-2.0.0.min.js:8

maybe the server is down chat:91

[14:13:52 GMT-0600 (Central Standard Time)] SignalR: Stopping connection. jquery.signalR-2.0.0.min.js:8

[14:13:52 GMT-0600 (Central Standard Time)] SignalR: Fired ajax abort async = true.

AppPool是为.NET 4.0配置的,我在web.config中有这个:

<modules runAllManagedModulesForAllRequests="true"/>

任何帮助将不胜感激。感谢。

2 个答案:

答案 0 :(得分:0)

建议不要在客户端操作系统上使用完整版本的IIS。请参阅此处的“支持的服务器IIS版本”:

http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/supported-platforms

答案 1 :(得分:0)

我不认为这个问题是由于将SignalR与nservicebus和IIS结合使用引起的,我有不同的工作解决方案。您提到的IIS设置与我的解决方案相同。我也在Windows 7上运行IIS也许你可以在web.config中找到不同的东西这是我的:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>   
<section name="DBSubscriptionStorageConfig"                  type="NServiceBus.Config.DBSubscriptionStorageConfig, NServiceBus.NHibernate" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" />
</configSections>
<UnicastBusConfig ForwardReceivedMessagesTo=.audit">
<MessageEndpointMappings>
  <add Messages="Transport.Events" Endpoint=.Transport.Service" />
</MessageEndpointMappings>
</UnicastBusConfig>
<DBSubscriptionStorageConfig UpdateSchema="true">
<NHibernateProperties>
  <add Key="connection.provider" Value="NHibernate.Connection.DriverConnectionProvider"   />       
  <add Key="connection.driver_class" Value="NHibernate.Driver.SqlClientDriver" />
  <add Key="connection.connection_string" Value="Server=.\SQLEXPRESS;Initial catalog=NServiceBus;Integrated Security=SSPI" />
  <add Key="dialect" Value="NHibernate.Dialect.MsSql2008Dialect" />
</NHibernateProperties>
</DBSubscriptionStorageConfig>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<pages>
  <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
  </namespaces>
</pages>
</system.web>
<system.webServer>
 <validation validateIntegratedModeConfiguration="false" />
 <modules runAllManagedModulesForAllRequests="true" />
 <handlers>
  <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
  <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
  </handlers>
 </system.webServer>
<runtime>
 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="StructureMap" publicKeyToken="e60ad81abae3c223" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.6.4.0" newVersion="2.6.4.0" />
  </dependentAssembly>
  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
  </dependentAssembly>
</assemblyBinding>
</runtime>  
</configuration>