简体   繁体   中英

Can you use SignalR with Visual Studio 2012?

I am trying to put together a SignalR app. Totally new to it, so following the MS tutorial, but have fallen at the first hurdle!

I can't add the SignalR Hub Class (v2) as described in this tutorial:

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

I am using VS2012, so this may be the reason I can't see it in the menu, or if I look in Add New Item...

The package installed fine, and I can see it in the package manager, but I can't add the hub class.

是的,只需创建一个空类,然后复制中心类的源和引用即可。

If you want Visual Studio 2012 to show you the SignalR Hub Class (v2) template in the Add | New Item dialog, you can follow these instructions shown in the same tutorial page (they are not easy to catch, I didn't see them the first time either):

Using Visual Studio 2012 with this tutorial

To use Visual Studio 2012 with this tutorial, do the following:

  • Update your Package Manager to the latest version.
  • Install the Web Platform Installer .
  • In the Web Platform Installer, search for and install ASP.NET and Web Tools 2013.1 for Visual Studio 2012 . This will install Visual Studio templates for SignalR classes such as Hub .
  • Some templates (such as OWIN Startup Class ) will not be available; for these, use a Class file instead.

In my case, the Web Platform Installer didn't find the ASP.NET and Web Tools 2013.1 for Visual Studio 2012 , so I had to download them directly from the web. You can download the installer from this link (I used the AspNetWebTools2013_1Setup.exe file).

Important Note

The templates don't appear on the Visual C# | Web | SignalR node as mentioned in the tutorial (there is no SignalR node on the New Item dialog box in Visual Studio 2012, as far as I can note), but they appear nonetheless in the Visual C# | Web node.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM