Use SignalR Sample Nuget package in VS2013 Preview MVC 5 Project

Use SignalR Sample Nuget package in VS2013 Preview MVC 5 Project

Rate This
  • Comments 6

We received feedback that the current 1.2 version SignalR sample Nuget package doesn’t work in an MVC 5 project by default. Here are the repro steps and the necessary change to make it work.

1. Create a C# MVC 5 project in VS2013 Preview

clip_image002

clip_image004

2. Install Microsoft.AspNet.SignalR.Sample NuGet package

clip_image006

3. This installs SignalR package version 1.1.3. In the SignalR.Sample/StockTicker.html file, the script link still links to 1.1.2, so change it to 1.1.3 first.

<script src="../Scripts/jquery.signalR-1.1.3.js"></script>

4. Run the application (I was using windows 8.1 preview with IE11), and get a JavaScript error:

clip_image008

5. What happened here is due to a bug in the 1.1.0-beta2 release of the Microsoft.Owin.Host.SystemWeb package, which will be fixed in future release. To work around this, the best way is to upgrade SignalR 1.1.3 to the latest 2.0 beta2 release.

6. Read http://www.asp.net/vnext/overview/latest/release-notes#TOC13 to understand the migration process from SignalR 1.x to 2.0. Migrating the sample package is a little bit simpler. First, upgrade the SignalR NuGet package to 2.0 Beta2 (select Include Prerelease in the drop-down at the top of the dialog):

clip_image010

7. A readme.txt file pops up talking about the hub registration. Compile to see the expected error message:

clip_image012

8. Delete App_Start/RegisterHubs.cs as it’s no longer used

9. In the root startup.cs file, add app.MapHubs(); in the Configuration method.

clip_image013

10. Change SignalR.Sample/StockTicker.html script link to 2.0

<script src="../Scripts/jquery.signalR-2.0.0-beta2.js"></script>

11. Run the html page, now you see that the SignalR sample works correctly.

clip_image014

The StockTicker sample package is open sourced at https://github.com/SignalR/SignalR-StockTicker. Currently it supports 1.x only, as SignalR 2.0 has not reached RTM yet. The sample will probably get updated by SignalR 2.0 RTM time.

Leave a Comment
  • Please add 1 and 5 and type the answer here:
  • Post
  • I was hoping for a "Fix" that would work with 1.1.3.  There are many scenarios where using a Beta package is simply not acceptable within a client's production code environment.

  • @David, we're working on it.  Just a note, MVC5 and its packages are also beta at this time.  

  • Xinyang Qiu,

    Thanks for the prompt response, and I agree that since MVC5 is also Beta, the point in this case is moot. My reasons for posting included the fact that I see this type of approach (usage of Beta software as a solution) far too often, and often it is not resolved for quite some time (if ever).  

    I also want to point out that based on what I am seeing in the preview, and as one of the ALM Rangers, I really like alot of what is being done!

  • Great Work, I was looking this type of example, keep it up.

  • no entiendo

  • @tem new,

    If you want to ask any questions about signalR, you can ask in Stackoverflow or asp.net forums.  For this sample, you can always take a look at the source: github.com/.../SignalR-StockTicker

Page 1 of 1 (6 items)