ASP.NET adventure! SignalR

As I’m an adventurer and I don’t want to get an arrow in the knee, I’ve put my wellington boots and dug a bit into the topic about distributed services, surrounding the web, brrrrhh!! Confused smile 

My friend Xavi (@XaviPaper) told me about SignalR when I mentioned an application that I want to make as a way to practice. In the meanwhile, to get sure that I’m not wasting time learning how to start my first SignalR application/s using old methods, I downloaded Visual Studio .NET 2013 RC (Release Candidate) to get the latest bits. I’m always with the new and tasty Smile But that usually means I problems.

After touching here and there I haven’t had any luck. So I asked Xavi who told me to go to “Variable not found” a blog run by José María Aguilar (@jmaguilar) who seems to be a master on this topic. I contacted him directly, and he kindly tried to guide me. I told them I would try to walk through all the process and come with the results. So I decided to do it and RECORD the process.

Yes, I armed myself and face the problem! knowing that some of the best colleagues are there to help me out. Jumping with a net is really better Smile

The first problem I encountered is that I cannot even have a working base application to start. The most basic skeleton for some simple app. Maybe it’s because I’m just too new to ASP.NET/MVC or whatever technologies are used for this (believe me, there are a lot of them implied into the most basic template!)

To illustrate my short journey into this new world I captured every step I did. Everyone is labeled with a number for anyone to refer to a particular step in order to correct me (because I think I’m doing it wrong in some place).

Step 1.

Visual Studio 2013 RC itself!

image

Step 2.

File > New Project…

image

Step 3.

I choose Visual C# / Web / ASP.NET Web Application and give it a name.

image

Step 4.

After clicking “OK”, a new dialog pops up. I choose MVC blindly. I don’t really know the reason to do it, but I’ve seen this in some tutorials Smile with tongue out I would like to make a web service that sits silently and serves a range of clients (Windows Phone 8 / Windows 8, for instance).

image

After that, I press “Create Project”

Step 5.

An entire structure is created. Wow. That is huge!

image

Step 6.

To add SignalR to the project I deduced I had to install the NuGet package. I choose to manage packages in the project.

image

Step 7.

I explicitly choose “Include prerrelease” in the combo and choose Microsoft ASP.NET SignalR. I press the “Install” button.

image

After that, a lot of packages (some even include JavaScript/jQuery, my dirty nemesis!)

Step 8.

A readme.txt file appears, giving some info about how to setup SignalR.

image

The document states:

“To enable SignalR in your application, create a class called Startup with the following”

Step 9.

It shows a sample class called “Startup” and it says that you have to create it, but oh boy! I discovered, horrified, that it already exists!!

image

Step 10.

It’s there! Startup.cs. Let’s check it.

image

Step 11.

Not only it already exist, but it’s different from the one that the readme.txt shows.

image

And now, what?

EDIT:

Step 12.

Following Jose María’s directions, I replace the code in the Startup class with the one the readme.txt file.

So the class remains:

using Microsoft.Owin; using Owin; [assembly: OwinStartupAttribute(typeof(ChorriApplication.Startup))] namespace ChorriApplication { public partial class Startup { public void Configuration(IAppBuilder app) { app.MapSignalR(); } } } 

 

Step 13.

After the change, I decide it’s time to run the application and I press F5 and this is what it’s shown!

image

Pretty good, uh? Open-mouthed smile It shows something, at least.

I close the browser window (Internet Explorer powah! Winking smile)

Step 14.

I’m trying to add a Hub class, since I have heard that hubs are like services that concurrently listen/send messages from clients.

I’m doing it via context menu, clicking over the project in the Solution Explorer.

image

A small dialog appears and I type my hub’s name.

image

Step 15.

Click on OK and a new class is created.

image

So, my Hub says hello? Well, and what can I do with that?

I think I’m done for today! I have no “clients” and NO IDEA of how to continue. I hope some colleague points out some new steps for me to follow.

But something is sure: whichever it is my way, I will show you Smile

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s