SignalR (Part 1) - Installation Process

Introduction

SignalR is a new library from Microsoft to develop real-time web applications. This library has been recently added to the Asp.Net Family. SignalR can work on .Net Framework 4.0 or later, it cannot work on the previous versions of .Net like v3.5 or prior. I have been learning about SignalR for quite some time now and I have thought to start a series of articles where I'll explain SignalR right from scratch. In this article, I explain how the SignalR library can be installed in your application. Please note the following points.

  1. By default, SignalR is not available with Visual Studio 2010. So if you are using VS 2010 and want to use SignalR in your application, then you will have to explicitly install it from the internet.
  2. For VS-2012, you can download and install the "Asp.Net 2012 fall Update" and can enjoy using SignalR for your application. Some links to download the updates are here.
  3. Installing SignalR is application-specific. For example, if you install it in Application A then you cannot use the library in Application B. You will need to install the library again for the new application.
  4. SignalR does not deal with database operations.

SignalR is lightweight and very simple to use. Let's try and understand how we can install it in our application. The following is the procedure for installing the SignalR package in your application.

Step 1. To install SignalR, you must first install the "Package Manager Console". You can download "Package Manager Console" from this link: "http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c"

SingleR1

The site should look something like as shown in the image above. Now simply click on the "Download" button and install this "Package Manager Console".

Step 2. Once the installation is complete, create/open your web application and you should be able to view this link in the "Tools" tab as shown in the image below.

 Installation

Step 3. Now click on the "Package Manager Console" option and you will see a window as shown in the image below.

Package Manager

Step 4. Now to install "SignalR Package", you must simply copy the statement shown below and paste it into the package manager console area. Here's the link to copy the command as shown below in the image. http://nuget.org/packages/Microsoft.AspNet.SignalR/.

Please note that while installing the SignalR package you need to have an internet connection.

SignalR Package

The final output should look something like this.

 Final output

Step 5. After writing the content in the "Package Manager Console", press Enter.

Package Manager Console

Step 6. All the necessary references and JQuery files are installed.

 JQuery

Step 7. After the SignalR package is installed, you also need to add "Json2" so that the request is parsed properly. Browsers like IE 8 or its previous version have problems parsing JSON or sending XHR Requests for long polling. Hence in the "Package Manager Console" add the following command and it will automatically install the Json2.js file and some references in your project

Package

Here's the link for adding the command: http://nuget.org/packages/json2

That's it, You have successfully installed the SignalR package in your web application. Hope you liked this simple article on "SignalR (Part 1) - Installation Process". In the next article, we will try to learn about the transport techniques used by SignalR for transferring data. Thank you for reading this article!!!


Recommended Free Ebook
Similar Articles