The leaderboard and chat sample demonstrates how you can combine ASP.NET and Node.js in the same web application. The application consists of the following components.
- An ASP.NET MVC 4 leaderbaord application using Entity Framework Code First.
- A Node.js server that leverages Socket.IO to handle real-time communication between chat users.
- A Redis store to persist Socket.IO connections and messages, permitting to scale out the chat services.
- Visual Studio 2010 or greater
- ASP.NET MVC 4
- Windows Azure SDK for Node.js 1.6 or greater
- IIS 7.5 Express or greater
- IISNode for IIS 7.5 Express or greater
-
Open the TanksterCommand.sln solution.
-
Compile the solution. The NuGet packages dependencies will be automatically downloaded and installed.
-
Create a Facebook Application and set the FacebookAppId and FacebookAppSecret in the web.config file. You must also set the Facebook Site Url for you Facebook application to the URL where your site will run locally, for example http://localhost:23595. See this post or Facebook's article for more details on setting up a Facebook app.
<add key="FacebookAppId" value="..." /> <add key="FacebookAppSecret" value="..." />
-
Press F5 to run the sample. Log in and try the Chat view.
-
Create a Windows Azure Web Site with a Database and download the publish profile. See this tutorial for more details.
-
After you have downloaded the publish profile open the project in Visual Studio. Right-click on the TanksterCommand project and click publish.
-
Import your publish profile and click publish.
-
Be sure to enable code first migrations in order to setup your database after you deploy.
-
Click publish and wait for the application to deploy.
-
After the applciation is published it will open in the browser. You can now login and test the chat.