Windows Azure Development
Windows Azure
How to deploy an ASP.NET web site to Windows Azure!
Jul 14th
Note I say web site – rather than web application.
If you have a web site, which is just a folder of files and stuff rather than a full blown VS project, you can easily deploy into Windows Azure without having to convert to a web app. (Of course you should really think about converting it because you get a better tool experience, debugging etc.)
I’m going to assume you have the Windows Azure SDK installed.
So the first thing is to get your files laid out on disk correctly. For our purposes I have a really simple web site containing a single default.aspx file. This is in a folder named ASPNetRole.
Next you need to create the cscfg and csdef files that Windows Azure requires to build a package. In the folder above I created the 2 files:
ServiceConfig.cscfg looks like this:
1: <?xml version="1.0"?>
2: <ServiceConfiguration serviceName="myaspapp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
3: <Role name="ASPNetRole">
4: <ConfigurationSettings/>
5: <Instances count="2" />
6: </Role>
7: </ServiceConfiguration>
ServiceDefinition.csdef looks like this
1: <?xml version="1.0" encoding="utf-8"?>
2: <ServiceDefinition name="myaspapp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
3: <WebRole name="ASPNetRole" vmsize="Small">
4: <InputEndpoints>
5: <!-- Must use port 80 for http and port 443 for https when running in the cloud -->
6: <InputEndpoint name="HttpIn" protocol="http" port="80" />
7: </InputEndpoints>
8: <ConfigurationSettings/>
9: </WebRole>
10: </ServiceDefinition>
Make sure the role names match what you want to call your role.
Now you have these 2 files you are all ready to go!
There are 3 tasks you may want to do.
1. Package the web site to run in the local developer fabric.
1: "c:\Program Files\Windows Azure SDK\v1.2\bin\cspack.exe" "ServiceDefinition.csdef" /role:ASPNetRole;ASPNetRole; /copyOnly
2. Run the local developer fabric package:
1: "C:\Program Files\Windows Azure SDK\v1.2\bin\csrun.exe" "ServiceDefinition.csx" "ServiceConfig.cscfg" /launchBrowser
3. Package ready to deploy to Windows Azure.
1: "c:\Program Files\Windows Azure SDK\v1.2\bin\cspack.exe" "ServiceDefinition.csdef" /role:ASPNetRole;ASPNetRole;
When you run the last script it will generate the package you need to deploy to Windows Azure. I usually pop the above into 3 script files named prefabric.cmd, runfabric.cmd and buildpackage.cmd.
Have fun.
THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS
Getting Started with Windows Azure
Jul 12th
A few folks today have been asking about how to get started with Windows Azure and/or SQL Azure. So here is my quick 3 steps to get you going.
- Make sure you have an OS that supports development!
You can use Vista, Windows 7, Server 2008 or Server 2008 R2. My recommendation is Windows 7 64bit. - Install the Microsoft Web Platform Installer from http://www.microsoft.com/web/downloads/platform.aspx .
- Once the installer loads – click Options:

- Click Developer Tools:

- Then click OK. You should now have the Developer Tools Tab:

- Under Visual Studio Tools, click Customize, then click Windows Azure Tools for Microsoft Visual Studio 2010 v1.2 and Visual Web Developer 2010 Express:

- Now click the Web Platform tab, and under database, click customize. Make sure SQL Server 2008 R2 Management Studio Express is clicked:

- Now Click install and confirm any options. Not only will the tools you selected be installed, the installer will also install any dependant bits too!
- While that is installing, navigate to here http://hmbl.me/1ITJKZ or here, download and install the latest version of the Windows Azure Platform Training Kit. There are some cool videos to watch to give you an overview.
- Once everything is installed, open the training kit and work through both the Introduction to Windows Azure and Introduction to SQL Azure lab.
Once you have that, the top resources to keep an eye on are http://www.microsoft.com/windowsazure, the awesome http://channel9.msdn.com/shows/Cloud+Cover/ and http://blogs.msdn.com/b/windowsazure/.
THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS
Speed up your workers with .net 4.0 parallel extensions
Jun 9th
Now you can use .net 4.0 in Windows Azure, it opens up some possibilities to get even more out of your workers. If you have workers that read messages from queues, then do some processing against storage, you may want to consider converting your message processing loops into parallel loops.
Here is the shell of some code and a typical pattern:
foreach (var s in masterList){// Do some work with s}
You can very easily convert this to use the parallel extensions by using the following code:
Parallel.ForEach(masterList, s =>{// Do some work with s});
So the code change is easy, but what is the difference?
Well you should certainly consider how much work you are doing for each message – short simple tasks probably won’t benefit from being parallel.
You should also consider how much IO is performed against storage etc. – the more IO performed the more you will benefit from using the extensions.
But David PLEASE GIVE ME SOME FIGURES.
Ok – here is the low down.
The code I have reads some data from a collection (loaded from a blob) then writes a row into table storage for each item in the collection. There is a total of 748 items in the collection spread across 7 partitions.
Without the parallel extension the results look like this across 3 identical runs:
| 1 | 2 | 3 | |
| Start Time | 13:55:01.4366386 | 14:04:59.5006458 | 14:08:37.6709250 |
| End Time | 13:55:36.2911237 | 14:05:28.4387517 | 14:09.20.3591933 |
No I don’t know what happened to the last one, but its around ~35 seconds or about 21 entities per second.
With the parallel extensions the results are:
| 1 | 2 | 3 | |
| Start Time | 14:23:51.2536114 | 14:28:54.6648367 | 14:31:58.3643092 |
| End Time | 14:24.03.0634712 | 14:29:08.3145661 | 14:32:10.2021354 |
That is a tad faster at ~14 seconds or about 53 entities per second (probably faster as I’m being generous here).
The tests were all done using a small VM size (1 core) and the tables etc. were deleted between tests. It’s not terribly scientific, but its good enough to show its worth looking into.
For a simple code change, that is not a bad days work.
You can find out some more about the extensions at http://msdn.microsoft.com/en-us/library/dd460693.aspx as well as the C9 10-4 show at http://channel9.msdn.com/shows/10-4/10-4-Episode-6-Parallel-Extensions/.
THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS, NOBODY EVER READS THIS BIT EITHER SO I DON’T EVEN KNOW WHY I BOTHER SOMETIMES
Windows Azure Platform Training Kit – June Update
Jun 7th
I’m pleased to announce the June update for the Windows Azure Platform training kit.
You can download it from here.
The training kit has everything you need to get started and then dig deep on the Windows Azure platform, including Windows Azure, SQL Azure, “Dallas”, Identity and the Windows Azure Platform AppFabric.
We have some minor updates to the training presentations and some new & updated hands on labs since the December release.
If you have used this content as a base for your own PLEASE take a look at the updated decks. I still see content from POST-PDC 09 that is now technically wrong.
Here is what is new in the kit:
- Introduction to Windows Azure – VS2010 version
- Intro To SQL Azure – VS2010 version
- Intro Service Bus – VS2010 version
- Intro To Dallas – VS2010 version
- Intro Access Control Service – VS2010 version
- Web Services and Identity in the Cloud
- Exploring Windows Azure Storage
- VS2010 version
- + new Exercise: “Working with Drives”
- Windows Azure Deployment
- VS2010 version
- + new Exercise: “Securing Windows Azure with SSL”
- Minor fixes to presentations – mainly timelines, pricing, new features etc.
We are currently working on updating the presentations and demos in the training kit. These will form the basis of a new 3 day course which digs much deeper into the platform – watch out for this update during July.
If you have any ideas on how we should improve the kit, please drop me an email. My email address is my firstname.lastname at microsoft.com.
Thanks
THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS
Security Best Practices for Developing Windows Azure Applications
Jun 2nd
Update (June 4th): There are a few errors in the guide which are being fixed by the authors. I’ll update this post again once they are fixed.
This is worth a read <link removed>
This paper focuses on the security challenges and recommended approaches to design and develop more secure applications for Microsoft’s Windows Azure platform. Microsoft Security Engineering Center (MSEC) and Microsoft’s Online Services Security & Compliance (OSSC) team have partnered with the Windows Azure team to build on the same security principles and processes that Microsoft has developed through years of experience managing security risks in traditional development and operating environments.
THIS POSTING IS PROVIDED “AS IS” WITH NO WARRANTIES, AND CONFERS NO RIGHTS