没有升级到SignalR-2.0.0-β2时所产生/ signalr /集线器 [英] /signalr/hubs not being generated when upgrading to SignalR-2.0.0-beta2

查看:380
本文介绍了没有升级到SignalR-2.0.0-β2时所产生/ signalr /集线器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序上SignalR 1.1.2运行将投入到负载均衡的服务器工作聊天,所以我需要实现一个背板解决方案,以保持同步的服务器。

这是一个ASP.NET MVC4 .NET 4.5应用程序。使用 SignalR集线器,而不是永久连接。该应用程序使用在客户端AngularJS处理UI绑定和更新。

我已经按照列出的工作步骤这里执行SQL服务器背板上,用在1.x中概述的2.0迁移的步骤概括出这里。该解决方案构建,但打了利用SignalR的页面时,/ signalr /集线器脚本参考返回500错误。

下面是列出的步骤我花了这么远。<​​/ P>

  • 使用的NuGet,删除有关SignalR 1.1.2所有引用和依赖性。双重检查/ bin和/包目录,以确保他们不再引用任何旧库。这是每发现在github上问题与2.0升级,它表示卸载并重新安装SignalR是顺便评论去升级。

  • 通过程序包管理器控制台安装SignalR 2.0.0-β2(PMC) 安装-包Microsoft.AspNet.SignalR - pre

  • 安装的SQL Server消息背板使用PMC 安装-包Microsoft.AspNet.SignalR.SqlServer - pre

  • 删除 RouteTable.Routes.MapHubs(); 从Global.asax中

  • 在项目的根目录中创建启动类。

Startup.cs

 使用Microsoft.AspNet.SignalR;
使用Microsoft.Owin;
使用Owin;

命名空间My.NameSpace
{
    公共类启动
    {
        公共无效配置(IAppBuilder应用程序)
        {
            app.MapHubs();
        }
    }
}
 

  • 新增&LT;添加键=owin:AppStartup值=My.NameSpace.Startup,APP_ code/&GT; &LT;的appSettings&GT; 里面的Web.config

  • 将断点在Startup.Configuration()方法,并证实它是越来越击中并执行app.MapHubs毫无例外应用程序启动的时候

  • 我不使用永久连接,所以不包括行 app.MapConnection&LT; MyConnection的&GT;(/回声); 和我没有得到任何模棱两可的定义问题。

  • 聊天应用页面引用以下库

    • jQuery的-1.8.3.js
    • jquery.signalR-2.0.0-beta2.js
    • &LT;脚本的src ='/ signalr /集线器'&GT;&LT; / SCRIPT&GT;
    • AngularJS V1.1.5
  • 在项目运行时, / signalr /集线器不受聊天应用页面上找到

  • Chrome浏览器开发工具的回报 500内部服务器错误 / signalr /集线器在网络上呼吁标签。

  • 文件系统不具有 / signalr /集线器目录

我的下一个步骤是看看我是否能创建一个非常基本的轮毂新的解决方案,看看我能得到的信号2.0工作。如果是的话,我会比较两个方案,看看有什么区别。

有没有人有什么我可以检查或研究得到这个工作的想法?

相关的StackOverflow问题与一个类似的问题:<一href="http://stackoverflow.com/questions/17613255/unable-to-register-routes-in-signalr-2-0-0?rq=1">one, <一href="http://stackoverflow.com/questions/17862446/how-to-use-signalr-v2-beta-in-asp-net-mvc-4">two

解决方案

原来,这个问题是固定的,通过改变项目配置使用本地IIS Web服务器,而不是Visual Studio开发服务器(卡西尼)。

转到 / signalr /集线器网​​址在浏览器中,看到这是服务器发现错误的原因

System.PlatformNotSupportedException:此操作需要IIS综合管道模式

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

您可以更改项目所用右击服务器,选择属性,点击网络选项卡,然后在这些服务器中选中使用本地IIS Web服务器。

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

解决方案

Turns out the issue was fixed by changing the project config to use Local IIS Web server instead of Visual Studio Developer Server (Cassini).

Found the cause by going to /signalr/hubs url in my browser and seeing the server error which was

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

Some googling turned up this page which said the error was caused by ASP.NET Development Server not supporting integrated pipeline mode.

You can change the server used by right clicking on the project, select properties, hit the web tab, and under the servers section select "Use Local IIS Web server".

这篇关于没有升级到SignalR-2.0.0-β2时所产生/ signalr /集线器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆