{"id":1444,"date":"2013-08-15T10:48:00","date_gmt":"2013-08-15T10:48:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2013\/08\/15\/use-signalr-sample-nuget-package-in-vs2013-preview-mvc-5-project\/"},"modified":"2022-08-09T06:14:16","modified_gmt":"2022-08-09T13:14:16","slug":"use-signalr-sample-nuget-package-in-vs2013-preview-mvc-5-project","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/use-signalr-sample-nuget-package-in-vs2013-preview-mvc-5-project\/","title":{"rendered":"Use SignalR Sample Nuget package in VS2013 Preview MVC 5 Project"},"content":{"rendered":"<p>We received feedback that the current 1.2 version SignalR sample Nuget package doesn&rsquo;t work in an MVC 5 project by default. Here are the repro steps and the necessary change to make it work.<\/p>\n<p>1. Create a C# MVC 5 project in VS2013 Preview<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/2678.clip_image002_thumb_597B1998.jpg\"><img decoding=\"async\" title=\"clip_image002\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/2678.clip_image002_thumb_597B1998.jpg\" alt=\"clip_image002\" width=\"628\" height=\"138\" border=\"0\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/6011.clip_image004_thumb_5FC1F026.jpg\"><img decoding=\"async\" title=\"clip_image004\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/6011.clip_image004_thumb_5FC1F026.jpg\" alt=\"clip_image004\" width=\"628\" height=\"389\" border=\"0\" \/><\/a><\/p>\n<p>2. Install <em>Microsoft.AspNet.SignalR.Sample<\/em> NuGet package<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/4784.clip_image006_thumb_5EE98A3C.jpg\"><img decoding=\"async\" title=\"clip_image006\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/4784.clip_image006_thumb_5EE98A3C.jpg\" alt=\"clip_image006\" width=\"628\" height=\"418\" border=\"0\" \/><\/a><\/p>\n<p>3. This installs SignalR package version 1.1.3. In the <em>SignalR.Sample\/StockTicker.html<\/em> file, the script link still links to 1.1.2, so change it to <a>1.1.3 first<\/a>.<\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">&lt;<\/span><span style=\"background: white;color: maroon\">script <\/span><span style=\"background: white;color: red\">src<\/span><span style=\"background: white;color: blue\">=\"..\/Scripts\/jquery.signalR-1.1.3.js\"&gt;&lt;\/<\/span><span style=\"background: white;color: maroon\">script<\/span><span style=\"background: white;color: blue\">&gt;<\/span><\/pre>\n<p>4. Run the application (I was using windows 8.1 preview with IE11), and get a JavaScript error:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/2555.clip_image008_thumb_4515540D.jpg\"><img decoding=\"async\" title=\"clip_image008\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/2555.clip_image008_thumb_4515540D.jpg\" alt=\"clip_image008\" width=\"628\" height=\"191\" border=\"0\" \/><\/a><\/p>\n<p>5. What happened here is due to a bug in the 1.1.0-beta2 release of the <em>Microsoft.Owin.Host.SystemWeb<\/em> 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.<\/p>\n<p>6. Read <a href=\"http:\/\/www.asp.net\/vnext\/overview\/latest\/release-notes#TOC13\">http:\/\/www.asp.net\/vnext\/overview\/latest\/release-notes#TOC13<\/a> 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):<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/4743.clip_image010_thumb_164F9B6B.jpg\"><img decoding=\"async\" title=\"clip_image010\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/4743.clip_image010_thumb_164F9B6B.jpg\" alt=\"clip_image010\" width=\"628\" height=\"418\" border=\"0\" \/><\/a><\/p>\n<p>7. A <em>readme.txt<\/em> file pops up talking about the hub registration. Compile to see the expected error message:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/2526.clip_image012_thumb_43648839.jpg\"><img decoding=\"async\" title=\"clip_image012\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/2526.clip_image012_thumb_43648839.jpg\" alt=\"clip_image012\" width=\"628\" height=\"440\" border=\"0\" \/><\/a><\/p>\n<p>8. Delete <em>App_Start\/RegisterHubs.cs<\/em> as it&rsquo;s no longer used<\/p>\n<p>9. In the root <em>startup.cs<\/em> file, add <em>app.MapHubs();<\/em> in the Configuration method.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/3603.clip_image013_thumb_34B9DC54.png\"><img decoding=\"async\" title=\"clip_image013\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/3603.clip_image013_thumb_34B9DC54.png\" alt=\"clip_image013\" width=\"431\" height=\"309\" border=\"0\" \/><\/a><\/p>\n<p>10. Change <em>SignalR.Sample\/StockTicker.html<\/em> script link to 2.0<\/p>\n<pre class=\"code\"><span style=\"background: white;color: blue\">&lt;<\/span><span style=\"background: white;color: maroon\">script <\/span><span style=\"background: white;color: red\">src<\/span><span style=\"background: white;color: blue\">=\"..\/Scripts\/jquery.signalR-2.0.0-beta2.js\"&gt;&lt;\/<\/span><span style=\"background: white;color: maroon\">script<\/span><span style=\"background: white;color: blue\">&gt;<\/span><\/pre>\n<p>11. Run the html page, now you see that the SignalR sample works correctly.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/4604.clip_image014_thumb_0CA72D35.png\"><img decoding=\"async\" title=\"clip_image014\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2013\/08\/4604.clip_image014_thumb_0CA72D35.png\" alt=\"clip_image014\" width=\"587\" height=\"470\" border=\"0\" \/><\/a><\/p>\n<p>The StockTicker sample package is open sourced at <a href=\"https:\/\/github.com\/SignalR\/SignalR-StockTicker\">https:\/\/github.com\/SignalR\/SignalR-StockTicker<\/a>. 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We received feedback that the current 1.2 version SignalR sample Nuget package doesn&rsquo;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 2. Install Microsoft.AspNet.SignalR.Sample NuGet package 3. This installs SignalR package version [&hellip;]<\/p>\n","protected":false},"author":410,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7439,7408,7398],"class_list":["post-1444","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-mvc-5","tag-signalr","tag-visual-studio-11-beta"],"acf":[],"blog_post_summary":"<p>We received feedback that the current 1.2 version SignalR sample Nuget package doesn&rsquo;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 2. Install Microsoft.AspNet.SignalR.Sample NuGet package 3. This installs SignalR package version [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/1444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/410"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=1444"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/1444\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=1444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=1444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=1444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}