无法在“添加新项”对话框中找到SignalR Hub类 [英] Cant find SignalR Hub Class in Add New Item dialog

查看:204
本文介绍了无法在“添加新项”对话框中找到SignalR Hub类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Guys,



我正在运行Visual Studio 2010,我安装了Nuget并将SignalR添加到我的项目中。



这里的主要问题是我无法在添加新项目对话框中找到SignalR Hub Class,是否必须连接到互联网并将其添加到Nuget的所有网站...



请帮助..

Hello Guys,

I am running Visual Studio 2010, i installed Nuget and added SignalR to my project.

The main problem here is that i cant find SignalR Hub Class in Add New Item dialog, is it that i have to connect to internet and add it to all websites from Nuget always..

Help please..

推荐答案

每次都不需要安装该软件包。

下载兼容的SignalR版本,复制已经安装在项目中的软件包文件夹中的dll文件,并将这些文件复制到项目的bin文件夹中。



Microsoft.AspNet。 SignalR.Core.dll



Microsoft.AspNet.SignalR.Owin.dll



Microsoft.AspNet。 SignalR.SystemWeb.dll



Microsoft.Owin.Host.SystemWeb.dll



Microsoft.Web。 Infrastructre.dll



Newtonsoft.Json.dll



Owin.dll



然后将Refrence添加到这些dll文件。



添加一个名为LetsHub的新类文件.cs。



在该文件中我编写了以下代码,

There is no need to install that package every time.
Download compatible version of SignalR, copy following dll files from package folder which is already installed in your project and copy these files in bin folder of a project.

Microsoft.AspNet.SignalR.Core.dll

Microsoft.AspNet.SignalR.Owin.dll

Microsoft.AspNet.SignalR.SystemWeb.dll

Microsoft.Owin.Host.SystemWeb.dll

Microsoft.Web.Infrastructre.dll

Newtonsoft.Json.dll

Owin.dll

then Add Refrences to these dll files.

Add a new class file called LetsHub.cs.

In that file i wrote the following code,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR.Hubs;
using Microsoft.AspNet.SignalR;

namespace demo.Hubs
{
[HubName("chatHub")]
public class LetsChat : Hub
{
public void SendMsg(string Message)
{
Clients.All.addMessage(Message);
}
}
}


您只能在Visual Studio 2013中找到SignalR Hub Class
you can find SignalR Hub Class in Visual studio 2013 only


这篇关于无法在“添加新项”对话框中找到SignalR Hub类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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