Knowledge is power. We love to share it.

News related to Mono products, services and latest developments in our community.

denis

Running MonoX on Azure

10/09/2012Categories: MonoX

As we all know, Windows Azure is a Microsoft cloud computing platform used to build, deploy and manage applications through a global network of managed datacenters. It allows for applications to be built using many different languages, tools or frameworks, including .NET, PHP and Node.js. As several exciting new features were introduced this June at the Meet Windows Azure event, and considering the amount of inquiries we receive related to Azure, I thought that it might be a good idea to explain how to deploy your MonoX-based applications and portals to the cloud.

People are often confused by the terminology used to describe the different services offered by the platform: Web Sites, Cloud Services and Virtual Machines. There are a few articles on the MSDN site that explain when to use which service; however, the best explanation I have found so far is written by David Pallman, Windows Azure MVP. Let’s start with Cloud Services: while having many attractive qualities and being one of the oldest and the most reliable members of the platform, they do force some compromises on application developers, and are not currently supported by MonoX. Virtual Machines (a new offering in the Azure family), on the other hand, are powerful, fully supported and very easy to manage – basically, you get your own virtual server that can be accessed via Remote Desktop Protocol, and you can work with it just like you work with your own in-house servers. This scenario is fully suported by MonoX, but such level of comfort comes at the price.

That’s why we we will focus on Windows Azure Web Sites (WAWS), as I think they are the best match for MonoX framework. They allow you to quickly and easily deploy ASP.NET, Node.js and PHP web-sites to a highly scalable cloud environment, so you can start small (and for free) and then scale up as your traffic grows.  You can create a new web site in Azure and have it ready to deploy to in under 10 seconds – other services take minutes just for the provisioning step.

To start deploying your MonoX-based solution to Azure, add new “Web site with database” in the administrative portal (note that I am using their new UI which is still in the preview stage – it should soon become the default for all users).

Azure home
New Web site menu
Create Web site wizard Create Web site wizard
Now, when a fresh database is set on the Azure side, we can export the database schema and data from our MonoX project. Note that there are some differences between SQL Database that is used by Azure and the standard, standalone SQL Server 2005, 2008, or 2012 databases that are used in virtually all MonoX deployments. In my experience, the easiest way to get around this type of issues is to use the SQL Database Migration Wizard, a wonderful, compact and free tool that will script and validate your MonoX database and upload it to your newly created site without hassle.

After you download and unzip the migration wizard utility and run the SQLAzureMW.exe, choose the Analyze/Migrate Database option.

SQL Azure Migration Wizard

This will allow you to select your server name, access credentials, and the database you want to export. The default MonoX database is exported and validated in just a few seconds: note that table data is held in the binary .bcp format and imported automatically by the tool after the schema is created during the database upload process. As it turns out, there are a few minor issues with the ASP.NET membership stored procedures that need to be corrected:  we had to remove the NOLOCK table hint from the aspnet_Membership_GetNumberOfUsersOnline SP; aspnet_Setup_RemoveAllRoleMembers SP was removed altogether as it requires unsupported sp_helpuser; all other issues were corrected automatically.

After this, you are ready to upload the schema and the data to Azure. Start the SQLAzureMW.exe again, but this time choose Run TSQL without analyzing, and select the script that was generated during the previous step. After validating the script, the migration wizard will ask you to provide the address of your Azure Web site and the credentials needed to access the database. Choose the database that was created while creating the Azure Web site, sit back and relax – it takes a few minutes, depending on your connection speed, to transfer the schema and the data to your site. You can use the “Manage” feature in the database section of the Azure management portal to confirm that all tables are created.

SQL Azure Migration Wizard
Azure Database Management Migration

You are now ready to deploy MonoX project package to your site. There are various ways to do it, but I’ve chosen the simplest approach that uses the good old FTP. Before that, please copy the Azure connection string (note the View connection strings option in the bottom right corner of the management screen) to your local MonoX Web.config file, so that your deployed MonoX instance could locate the Azure database we have prepared in the previous step.  The FTP host address and username will also be displayed on this screen. You just have to use your favorite FTP client and upload the contents of your MonoX-based application to the /site/wwwroot FTP folder at the Azure server. Once this is completed – and it can take a while, as there can be several thousands of project files to upload – you should be able to access the site right away.

Web site administration

We have big plans for Azure-based scenarios in the next versions of MonoX. Stay tuned, and please do not hesitate to contact us if you need more information or help with deploying your solutions to the cloud.

Rated 4.33, 6 vote(s). 
By Sergey
I can`t install MonoX((((Can you help me for this mistake?
denis
Hi Segey,
Could you please open a new topic in our support forum to address your issues? We will need more information (did you upload the database per instructions in this article, etc.)
By Duncan
Are there any issues with installing a new copy of MonoX directly into Azure space (not the transfer of an existing project)?
denis
No, there are no such issues.
By Naadev
I asume there is no support for file storage on it...
khorvat
I think that in a near future we will have a Azure file provider available so please stay tuned.

Regards
Here is another database that is compatible with Mono:
http://www.kellermansoftware.com/p-43-ninja-net-database-pro.aspx
Dinesh-Sajwan
Hi,

Is the latest version 5.1 of Monox compatible with MS Cloud.
How is Session Management Done in Azure and how is local storage handled (as windows azure doesnt support local storage)

Regards
Sumit
khorvat
Hi Sumit,

yes latest MonoX v5.1 is compatible with Azure. Session management can be done by using InProc, SQL, Azure Cache or some other provider and same applies to the local file storage.

If you have any technical question please post them to MonoX support forums.

Regards