SignalR 2.0.2创建PersistentConnection [英] SignalR 2.0.2 Creating PersistentConnection

查看:569
本文介绍了SignalR 2.0.2创建PersistentConnection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装SignalR 2.0.2到我的MVC 4.5应用程序通过使用包管理器控制台。而我做了连接配置标准的例子。

I installed SignalR 2.0.2 to my MVC 4.5 Application by using package manager console. And I did the standard example for the connection configuration.

namespace SignalRPersistent
{

    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.MapSignalR("/echo");
        }
    }
}

问题是MapSignalR方法不接受字符串,在编译时错误说,

The problem is MapSignalR method does not accept string, while compiling the error says that

参数类型的字符串是不能分配给参数类型SignalRHubConfiguration。但我可以看到,接受字符串的重载方法,但它坚持不进行编译。可以采取什么问题呢?

Argument type string is not assignable to parameter type SignalRHubConfiguration. But I can see an overload method that accepts a string but it insists not to be compiled. What can be problem ?

推荐答案

我改变了code像下面,我开始工作。

I changed the code like below and I started to work.

app.MapSignalR<ConnectionHub>("/echo");

ConnectionHub 是从PersistentConnection继承类。在互联网上的例子并不需要指定类,但他们没有为我工作。

ConnectionHub is the class that inherit from PersistentConnection. The examples on the internet does not require to specify the class but they didnt work for me.

这篇关于SignalR 2.0.2创建PersistentConnection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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