Recently I moved several of my Web sites to Windows Azure Web Sites. The previous version of the sites were running as shared sites using two different Web providers. One of the sites was using ASP.NET MVC 3 and a SQL Server, the other one using Flash and PHP. The Web site with Flash needed a complete redesign and a new implementation. The move was really easy to do, and all the sites are now running fine. This article describes how I did the move.
One database for multiple sites
http://www.cninnovation.com was running previously on a shared hosting site with ASP.NET MVC 3 using SQL Server from the same provider. Information about training and books is coming from SQL Server. I’ve written many books and offer many different courses, but this is still not a lot of data for a database. Windows Azure now has a great offer for SQL databases that is just USD 5,- (EUR 3.55) for 100 MB. This is less than I was paying for my previous SQL Server database.
http://www.kantine.at didn’t use any database before. However, the site became a complete new redesign now using HTML5 and ASP.NET MVC 4, and all the information about menus, drinks, and latest information is coming from the database as well. A lot of menus is not a lot of data as well. I’m using the same database as for the CN innovation site, just using different schemas for the tables. This makes a great separation between the different sites.
Moving the database from the old site to Windows Azure is an easy task, as for example described by WriJu using SQL Server Management Studio, there’s also a SQL Database Migration Wizard on CodePlex. As I’m using a different schema in the new SQL Azure database, I’ve just used a script that I generated from Visual Studio 2012. The script creates tables and fills them with data. I’ve modified the script for the new schemas, and created and filled the tables on Windows Azure.
The change for the CN innovation site just needed minor changes to the data access code for the new schema, and a change in the connection string.
Publishing to Windows Azure Web Sites
After doing a “Quick Create” of a Windows Azure Website I published my CN innovation site directly from Visual Studio 2012 to Windows Azure. This is one really great feature to publish the site from the Solution Explorer in Visual Studio directly to Windows Azure. The publish profile needed for that can be exported from the Windows Azure Management Portal, imported from Visual Studio, and it’s not necessary to deal with username, password, the correct link for publishing, and so on.
For the first tests I was using a free shared instance. For going live a DNS entry was needed. This required a reserved instance at that time. I just couldn’t switch to a reserved instance because there was no one free in West Europe. I had to wait for nearly two weeks before the switch was possible. At first I was afraid that I needed to switch every Web site to a new reserved instance. However, that’s not the case. Switching to reserved instance all my Web sites moved to the same reserved instance. I ‘m just paying one reserved instance for all the Web sites. With the recent changes I can run a hundred sites in one reserved instance. So I’m just paying one small VM for USD 57,60 (EUR 40,85) for the compute instance for all my sites.
A new Web application
The www.kantine.at Web site was previously done with PHP and Flash, just offering a flashy home page and a guest book that wasn’t really used. This site got a complete new design and implementation. The guest book is replaced by a Facebook page that’s linked from the home page. The home page gives actual news and the menu of the day.
You can see some images about the restaurant such as this…
…can read about the menus of the week…
and find the location by using Bing maps.
Don’t start development with .NET 4.5 to deploy to a Server running .NET 4
Christine Mark was doing the design and delivered HTML5 and CSS pages. I’ve created the solution with ASP.NET MVC 4, started the project with .NET 4.5. With this I moved the HTML content that I received to the layout and views of the ASP.NET MVC architecture. All the different menu cards are served from the same controller action which allows sharing a lot of HTML code. To give the current selection of the page and menu card a different look, jQuery helped to change the style for the active item. For accessing the database I’m using Entity Framework Code-First. I’ve been using the NuGet package for the new Entity Framework features.
Before deploying to Windows Azure just don’t forget – .NET 4.5 is not available with Azure yet. With Windows Azure you’ll only see released framework versions. Now as .NET 4.5 is released, I’m expecting the new .NET version with Windows Azure soon. Ok, I switched back to .NET 4.0 with a simple change in the project settings. Running and testing the application locally everything is fine. Deploying it to Windows Azure, the application failed. I’ve turned on error information to see the issue, which was a missing method in the Entity Framework library. It turned out that the Entity Framework NuGet package behaves differently if it is added to a .NET 4.5 or .NET 4 project. As I added it to a .NET 4.5 solution, some methods were used that have been available on my system (as .NET 4.5 is installed here), but not on the target system on Windows Azure. Deleting the NuGet package and adding it again helped, and the application was running great on Windows Azure.
It’s easy to switch from .NET 4 to .NET 4.5, but there are issues switching back. I’ve had the experience already several times, I just need to remember it
Windows Azure Storage
The images for the menus – e.g. with salads – are not served from the SQL database. I try to keep the SQL database small, and use for larger items such as these images Azure Storage. The price is very different. For geo-redundant storage, 25 GB costs USD 3.13 (EUR 2.22). That’s a lot cheaper than relational data.
Making the final move from the test environment in Windows Azure to the production sites, was just a matter for changing the DNS entries.
The client application to manage the menus is a Windows Store client app. This is the topic of another blog article.
For more information on Windows Azure, ASP.NET MVC, jQuery, and Windows Store apps see my workshops. More information on ASP.NET MVC and Windows Store apps is also found in my new book Professional C# 2012.
Christian
Your work expression is simple, easy to understand, write very have feelings, is very realistic. Good fortune to
be able to see your this article, I hope that I can still have a chance!
Posted by: sac louis vuitton | 10/09/2012 at 09:47 AM
Love the part that says Content precedes design. Design in the absence of content is not design, its decoration. I'm not too sure about that, people who are not that computer knowledgeable tend to look more on design rather than reading about stuff first.
Posted by: Custom Web Design and Development | 11/26/2012 at 07:23 AM
The Flip covers are good,is any color available in these slip covers,so share the colors details that you have,and 3 Flip covers we getting will be of same colors? cars for sale.
Posted by: term papers online canada | 02/27/2013 at 12:19 PM
This makes new installations a lot easier, as the data comes automatically to my newly installed system without talking care to copy everything.
Posted by: dissertations.superiorpapers.com | 03/01/2013 at 07:23 PM
Very good website you have here but I was wanting to know if you knew of any community forums that cover the same topics talked about in this article? I'd really love to be a part of community where I can get feedback from other knowledgeable individuals that share the same interest. If you have any recommendations, please let me know. Appreciate it!
Posted by: website design firms | 09/14/2013 at 11:44 AM
I do not even understand how I finished up right here, but I thought this post was good. I do not recognise who you're however certainly you are going to a well-known blogger if you are not already. Cheers!
Posted by: www.website-design-templates.org | 09/17/2013 at 12:45 PM
Good post. I learn sometjing new and challenging on websites I stumbleupon everyday. It will always be exciting to resad through content from other authors and usee something froom their web sites.
Posted by: Click here.. | 09/18/2013 at 08:07 AM
It's remarkable for me to have a website, which is useful in support of my experience. thanks admin
Posted by: website design tutorial | 09/19/2013 at 07:34 PM