Return To Wiki

# Foundation Cloud Server (3/15/2015)

Nicholas Ventimiglia | http://unity3dfoundation.com

A Cloud host-able Asp.Net MVC solution specialized for Unity3d

  • Asp.Net MVC is a world class C# 4.0 open source web server
  • Graphical (Html) Developer and Administration portal
  • Multi-tenancy ready, host multiple games off a single install
  • All server Api's have a Unity3d service client ready to go !
  • Account Api with sign in, sign up, account recovery, and guest mode
  • Support for branded emails for Account Recover and New Users (Welcome)
  • Storage Api with support for dynamic (untyped) objects
  • Realtime API for integration in the Realtime cloud messaging service
  • Easily extend the solution with custom ApiControllers
  • Uses easy to host SQL database using Entity Framework
  • Data tables are flat and normalized making a conversion to Redis, MongoDB or RavenDB fast !

    Prelude

    The Server is a asp.net mvc solution. MVC is a world class open source web framework developed by Microsoft. I chose it because it is fast, scalable and written in C#. You should have a basic understanding of how to develop with this technology before you begin. I also recommend using at least Visual Studio 2013 as your IDE.

  • http://www.asp.net/mvc/overview

  • https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx

You will also need a webhost to host the solution on the world wide web. Most any host that supports windows and mssql will do. I have tested this package on cheap $2 a month hosting as well as Azure.

Lastly, the next iteration of MVC (vNext) will support hosting on Linux web servers. I will update the package when this is released.

Nuget package restore

The webserver has a number of dependencies. These must be loaded using nuget. Right click on the solution file in the solution view and select Manage Nuget Packages For This Solution. You will be prompted to restore missing packages. Once complete rebuild the package and any missing reference exceptions will be remedied.

Install the database

In the root there are two sql generation scripts : Cloud.sql and Account.sql. Running these scripts will generate the sql tables. You may run these scripts together if you wish to use a single database.

Web.Config

There are a number of settings that must be configured in the web.config.

Connection String

There are two connection strings AccountContext and CloudContext. You must set the connection string to reference your newly created database. These strings should be given by your host when you setup the database. In the comments below are two example connection strings.

AppSettings

There are a number of appSettings, most of which you may ignore. I will point out the important ones.

  • ResetExpiration : Hours that the User Recovery Token is valid.
  • EnableDevelopers : Enables new developers to register. Turn this off in production.
  • AesKey : Key used to encrypt user passwords. (AED 256)
    • http://{url}/Home/Aes
  • AdminPassword : Default password of Admin user (create on installation).
  • AdminEmail : Default username / email of Admin user (create on installation).
  • Mail : Settings for the email service.

System.Net.MailSettings.Smtp

Information for logging into your host's outgoing smtp mail server. For hosting on Azure I recommend using http://sendgrid.com as an smtp provider.

Running

Now the application is setup and you are good to run and/or deploy the app.

Email Templates

The email system allows for send users email when they sign up, request a token and when they update their account info. This allows for two-factor authentication and enables users to manage their accounts without any interaction on your part.

There are three emails sent from the system: Welcome when the user first signs up. Token will send a validation token for when the user requests a change to their account's email or password. Update notifying the user of any change to their account's details.

You may customize these emails by uploading Email Templates. These templates support RAZOR syntax. Razor syntax is an HTMLesq markup language with support for injecting 'Model Values'.

Download

Download Templates

Once the package has been downloaded and your templates augmented, please upload them to your application using in the Dashboard/Files sub menu.

Return To Wiki