7

I have a working chat like application running on SignalR 1.1.2 that will be put onto load balanced servers, so I need to implement a backplane solution to sync up the servers.

This is an ASP.NET MVC4 .NET 4.5 application. Using SignalR Hubs, and not Persistent Connection. The app utilizes AngularJS on the client side to handle the ui bindings and updates.

I've followed the steps listed out here to implement the sql server backplane and used the steps outlined in the 1.x to 2.0 migration outlined out here. The solution builds, but when hitting the page that utilizes SignalR the "/signalr/hubs" script reference returns a 500 error.

Here's a list of steps I took so far.

  • Using nuget, removed all references and dependencies related to SignalR 1.1.2. Double checked /bin and /packages directories to make sure they no longer reference any old libraries. This is per comment found on the github issue relating to a 2.0 upgrade that said uninstalling and reinstalling SignalR was the way to go for an upgrade.

  • Installed SignalR 2.0.0-beta2 via Package Manager Console (PMC) Install-Package Microsoft.AspNet.SignalR -Pre

  • Installed SQL Server Messaging Backplane using PMC Install-Package Microsoft.AspNet.SignalR.SqlServer -Pre

  • Removed RouteTable.Routes.MapHubs(); from Global.asax

  • Created Startup class in root of project.

Startup.cs

using Microsoft.AspNet.SignalR;
using Microsoft.Owin;
using Owin;

namespace My.NameSpace
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.MapHubs();
        }
    }
}
  • Added <add key="owin:AppStartup" value="My.NameSpace.Startup, App_Code"/> to <appSettings> inside Web.config

  • Put a breakpoint in the Startup.Configuration() method and verified that it was getting hit and executing app.MapHubs without exceptions when the app started

  • I'm not using Persistent Connection, so did not include the line app.MapConnection<MyConnection>("/echo"); and am not getting any ambiguous definition issues.

  • The chat app page references the following libs

    • jquery-1.8.3.js
    • jquery.signalR-2.0.0-beta2.js
    • <script src='/signalr/hubs'></script>
    • AngularJS v1.1.5
  • When the project runs, /signalr/hubs is not found by the chat app page

  • chrome dev tools returns 500 Internal Server Error for the /signalr/hubs call on the network tab.

  • the file system does not have a /signalr/hubs directory

My next step is to see if I can create a new solution with a very basic hub and see if I can get Signal 2.0 working. If it does I'll compare the two solutions to see what the differences are.

Does anyone have an idea of what else I could check or research to get this working?

Related StackOverflow questions with a similar issue: one, two

4

2 回答 2

12

事实证明,通过将项目配置更改为使用本地 IIS Web 服务器而不是 Visual Studio Developer Server (Cassini) 解决了这个问题。

通过转到/signalr/hubs我的浏览器中的 url 并查看服务器错误来找到原因

System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.

一些谷歌搜索出现了这个页面,它说错误是由 ASP.NET 开发服务器不支持集成管道模式引起的。

您可以通过右键单击项目更改使用的服务器,选择属性,点击 Web 选项卡,然后在服务器部分下选择“使用本地 IIS Web 服务器”。

于 2013-07-31T00:32:06.357 回答
0

在我的情况下,IIS 没有正确安装。我只需要重新安装它:

c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
于 2014-01-08T15:11:54.980 回答