dotNET Developers

Rock Paper Azure Challenge - Spring Fling Winners: Weeks 1 & 2

JrzyShr Dev Guy - May 2, 2012 - 12:12am

In April, I announced the the Rock Paper Azure Challenge was back with a new Spring Fling round with winners every Friday through June 15, 2012.  I’m a little late in getting this information posted, but wanted to share the winners for weeks 1 & 2.  Congratulations to the top 3 bots from each week so far! 

Week #1 Winners – 4/20/2012
  1. choi – $50 Best Buy giftcard
  2. FistofImmortality – $25 Best Buy giftcard
  3. Protist – $10 Best Buy giftcard
Week #2 Winners – 4/27/2012
  1. TheJeffer – $50 Best Buy giftcard
  2. FistofImmortality – $25 Best Buy giftcard
  3. benrick – $10 Best Buy giftcard

Note: The bot named “Toidi” finished in 2nd place on 4/27/2012, but is not from the US. The Spring Fling round is open to US residents only.

If you haven’t taken the Rock Paper Azure Challenge yet, it’s time to get in the game!  There are 7 more weeks of weekly prizes left.  Just a reminder, at the end of the round on June 15, 2012, there will be three sweepstakes prizes awarded at the end on June 15, 2012 to randomly drawn entries in the Spring Fling round. All you have to do is get in the game for a chance to win:

What is the Rock Paper Azure Challenge?

I first announced the Rock Paper Azure Challenge here back in April 2011.  The RPA Challenge is a fun way for developers to learn about Windows Azure and possibly win a few prizes along the way.  In short, you get to code a “bot” that will play the childhood game of “Rock, Paper, Scissors” against other contestants’ bots.  The game allows you to flex your coding skills by rewarding developers for coming up with the best best “bot” algorithm.

Now is the time to get in the game and code your best bot!

Get started with the “Get Started” page on the Rock Paper Azure Challenge website.  This page has links to the downloads and screencasts that step you through the Bot coding process:

Get Started with Rock Paper Azure

Good luck this time around!  And if you have any questions, post them here or e-mail us at rockpaperazure AT


Ancora Imparo - Scott Watermasysk - May 1, 2012 - 11:24am

CtrlP is a vim plugin for finding files.

Unlike CommandT, my previous favorite, CtrlP is written completely in Vimscript.

As a side benefit, CtrlP will also optionally search your open buffers. This means I can also remove the BufExplorer plugin.

I forget why, but I have always had CommandT mapped to leader+f. So to take full advantage of CtrlP I am using the following settings:

map <leader>f :CtrlP<CR> map <leader>b :CtrlPBuffer<cr> map <leader>m :CtrlPMRU<cr>

Vote for the Imagine Cup People’s Choice Award

JrzyShr Dev Guy - April 30, 2012 - 4:26pm

It’s that time of the year again: Imagine Cup People’s Choice Award!!! The People’s Choice award is part of the Imagine Cup.

What is the Imagine Cup?

The Microsoft Imagine Cup is the world’s premier student technology competition. Microsoft invites all eligible students to use their imagination and passion to create a technology solution that addresses the Imagine Cup 2012 theme: Imagine a world where technology helps solve the toughest problems.

In ten years, the Imagine Cup has grown to be a truly global competition focused on finding solutions to real-world problems. Since 2003, over 1.4 million students have participated in the Imagine Cup with 358,000 students representing 183 countries and regions registering for the Imagine Cup 2011 competition.

Vote For the People’s Choice

Now is the stage of the Imagine Cup where YOU get to vote on your favorite projects and games. Here’s how it works: go to the People’s Choice Facebook page, check out the team pages and vote for your favorite. You can vote everyday (until May 19th), so vote often! There are prizes for the teams and the voters!

The Imagine Cup team with the most votes will win a an all-expense paid trip to Sydney, Australia for the Imagine Cup Worldwide Finals this July.   Additionally, anyone who vote will be entered for a chance to win weekly prizes including Acer ultrabooks, GAEMS Xbox bundles, Beats by Dr. Dre headphones and more!

There are three ways to vote

  1. Visit the Facebook page and click “vote” on your favorite team
  2. Send this tweet: “@mstechstudent I am voting for #<TEAMNAME> in #ICPeoplesChoice. Rules:
  3. Text your favorite team name’s code (listed on their team page) to 45444

You can vote every day, on each platform, for each of the teams!

30 to Launch Azure Challenge Events in NYC and Philadelphia

JrzyShr Dev Guy - April 27, 2012 - 3:27pm

My colleagues on the Microsoft Startup Evangelism team are throwing a Windows Azure App Challenge in both NYC and Philly during the month of May.  I’ll be doing the “NJ Turnpike shuffle” to help out in both cities.  Join us over 3 weeks to build your Azure app!

If you are looking to start a cloud business, port your app to the cloud, or extend an existing app – 30 to Launch is for you. From technical and business consulting time to daily tips to keep you on track, your cloud business you can really kick start things with this program.

Why should I care?

You could go home with an Xbox 360+Kinect Bundle*! And you’ll learn how to develop applications for Windows Azure.

What are the details?
  • We will be hosting three sessions in the 30 days. (Read on below to learn more!)
  • As you learn, develop a new application prototype and a 2 minute presentation about your app.At the last session, pitch your app to the class and the best pitch (audience judged) gets and Xbox 360+Kinect 250GB Bundle!
  • At the last session, pitch your app to the class and the best pitch (audience judged) gets and Xbox 360+Kinect 250GB Bundle!
Dates & Registration New York Philadelphia

Microsoft NYC Offices
1290 Ave Of The Americas, 6th Floor
New York, NY 10104


5/2/2012 – 12:00pm – 4:00pm 
5/14/2012 – 1:00pm – 3:00pm
5/22/2012 – 1:00pm – 5:00pm


1650 Arch Street, Suite 1906
Philadelphia, PA 19103


5/3/2012 – 6:00pm – 10:00pm
5/17/2012 – 6:00pm – 9:00pm
5/23/2012 – 6:00pm – 9:00pm

REGISTER PHILLY! The 30 to Launch Challenge Goes Like This Dates Agenda Weeks 1 & 2:

5/2/2012 - NYC
5/3/2012 – Philly Pre-Work: Get started on Windows Azure!

Session 1. Getting Started with Windows Azure (food and drinks provided)

  • Introduction to Cloud and 30 to Launch
  • Overview of the Azure Platform
  • Azure Platform Core Services
  • Azure Roles
  • Azure Storage
  • Azure Setup and Tools
  • Supported Development Languages
  • Azure Scale


Session 2: Get Coding!

Set up your Azure account and get started.

Speakers: Peter Laudati, Brian Johnson

Week 3:
5/14/2012 - NYC
5/17/2012 – Philly

Office Hours

Session 3: Come answer your questions on W8 (food and drinks provided)

Speaker: Brian Johnson, Peter Laudati, Dani Diaz

Week 4:
5/22/2012 - NYC
5/23/2012 – Philly

Pitch Day!

Session 4: Pitch your App and hear feedback from others (food and drinks provided)
Speaker: Brian Johnson, Sumit Shukla

The Rules

 *No Purchase Necessary. Open only to hobbyists, professionals, or developers in the field of software tech who are legal residents of the 50 U.S. or D.C. 18+. Microsoft is committed to complying with government gift and ethics rules and therefore government employees are not eligible. Game ends 5/23/12. For more details, see the Official Rules.

Not in NYC or Philly?

Not from this area?  Can’t make it to The Big Apple or City of Brotherly Love?  You can participate in the online version of this challenge.  See the 30 to Launch website for more details.

Looking forward to see what folks will build!

Editing via Vim's Visual Blocks

Ancora Imparo - Scott Watermasysk - April 27, 2012 - 10:23am

I have been reading Practical Vim. I am only 25% through it, but if you value productivity this book is easily worth 10 times it’s asking price.

Anyway, but to Visual Blocks. To be honest, I never saw the value in them because changes I made where not reflected on each line.

Turns out, all I needed to was be patient. When you edit code in a visual block (<C-v>) the changes are not displayed on all lines until after you hit <ESC>.

I really need to keep reminding myself of the following: If it doesn’t appear easy to do in VIM, you are likely doing it wrong.

Send to Kindle

Ancora Imparo - Scott Watermasysk - April 26, 2012 - 10:12pm

Have a Kindle or use a Kindle App? Do you also have a Mac?

If you answered yes to both questions you need this app: Send to Kindle.

The Send to Kindle app is a simple tool which lets you easily send books (and documents) to all your Kindle enabled devices.

Wade Wegner on Managing Concurrency with Multiple Instances: May 2nd, 2012 @ the NJ Windows Azure User Group

JrzyShr Dev Guy - April 26, 2012 - 12:25pm

Last month, the NJ Windows Azure User Group had a great presentation from Jim Priestley on migrating a real world e-commerce site to Azure.  Jim shared his experiences and lessons learned migrating to the cloud.  There was a lot of insight regarding performance of SQL Azure and running an ASP.NET MVC site in the Azure compute environment.  This month, the group is keeping the momentum going with another great speaker!

Next Wednesday, on May 2nd, Wade Wegner will be in town.  Wade was on the Windows Azure team at Microsoft in Redmond. He recently joined Aditi as their CTO. Wade will be on the east coast next week doing some work for his new company and agreed to make it to the user group on Wednesday night.  You won’t want to miss this meeting as you’ll be speaking with a person who has plenty of inside knowledge on Windows Azure!  Here’s Wade’s abstract from the NJ Windows Azure User Group website:

Managing Concurrency with Multiple Instances in Windows Azure

One of the basic challenges in dealing with multiple instances in Windows Azure is managing concurrency. For example, consider a scenario where you need to keep an accurate count at scale. With many simultaneous requests coming to many role instances all updating the same number, the difficulty arises in making sure that number is correct and that the writers don’t spend a lot of time retrying after concurrency failures.

Join Wade Wegner, CTO at Aditi Technologies and former Director of Windows Azure Technical Evangelism at Microsoft, as he talks through this problem and provides a solution for managing concurrency across multiple role instances in Windows Azure.

Wade Wegner

Wade is currently the CTO at Aditi Technologies, where he is responsible for driving Aditi’s technical strategy and ensuring continuous innovation on behalf of its customers. Prior to joining Aditi, Wade held several roles in Microsoft, most recently leading Technical Evangelism for Windows Azure.

Microsoft Office - 101 Wood Ave S, Iselin, NJ 08830 Want to join us next Wednesday?  Then register here: REGISTER HERE!

Date: Wednesday, April 4, 2012
Time: 6:30pm

Microsoft NJ Office
101 Wood Ave South, 9th Floor
Iselin, NJ 08830

Top 7 Concerns of Migrating an ASP.NET Application to Windows Azure

JrzyShr Dev Guy - April 25, 2012 - 12:28pm

This post is part of a series called “Windows Azure for the ASP.NET Developer” written by Rachel Appel, Adam Hoffman, and Peter Laudati.  You can see the complete list of posts in the series at the US DPE Azure Connection site.

In the previous post of this series, I covered how to prepare your development environment for building Windows Azure applications. I left you with some references to walkthroughs to build your first “Hello World” ASP.NET application for Windows Azure.  Those walkthroughs are great tutorials for getting familiar with the tools and cloud environment. 

However, as developers, it is rare that we get the opportunity to do a “File –> New Project” in our day to day work.  More often than not, the next step after learning “Hello World”, is usually, “Okay, let’s see if I can get my app running in Azure.”  That’s where the real fun usually begins and where your “Hello World” experience might not match the experiences you have migrating an existing ASP.NET application to the cloud.

In this post, I’ll describe the typical concerns encountered when migrating an existing ASP.NET application to Windows Azure.  My goal is not to cover the details of how to handle each of these, but rather to provide a guide with the proper pointers that will help you on your way as you plan a migration.  I’ve organized these concerns into a “Top 8” list, however, they are in no particular order.

Understanding the Windows Azure Compute Environment

Before you review the migration considerations, it is important to understand how the Windows Azure Compute environment works. In the second post of this series, Rachel Appel covered some of the differences between Windows Azure and Windows Server.  I will expand upon those here, primarily with a focus on how deployment, recovery, and elasticity work. This will make the migration concerns more obvious and easier to understand.

Windows Azure Compute is a “Platform-as-a-Service” offering.  This means that the operating system and application platform are provided for you.  There is no need to create and manage the virtual machine(s) that your application will run in. The unit of deployment for your application is essentially your packaged application code and its associated configuration for how it should run in the cloud.  This unit of deployment is referred to as a “Windows Azure service” or a “hosted service”.

Deployment in Windows Azure Compute

When you deploy your hosted service to Windows Azure, you upload the two files that make up your hosted service:

  • <yourWindowsAzureProjectName>.cspkg – The service deployment package (zip-like) file containing the contents of your application.
  • ServiceConfiguration.Cloud.cscfg – An XML configuration file containing the settings for how your hosted service will run in Windows Azure.

Windows Azure stores those files in a triple redundant storage location.  These two files are considered the “base” or “snapshot” of your application’s deployment.  Windows Azure then inspects the configuration file to determine how many roles (VM types) and instances of each will be needed for your application.

Windows Azure will then load as many ‘vanilla’ Windows Server virtual machine instances as required by the configuration.  These ‘vanilla’ Windows Server VMs are “clean” machines with no software or data installed on them other than the necessary agents needed to communicate with the Windows Azure data center.

Once the Windows Server VMs are loaded, Windows Azure will perform any startup tasks specified in your application’s Service Configuration (.cscfg) file on each instance.  This includes installing software dependencies, modifying registry settings, or modifying advanced configuration settings for IIS.

Finally, Windows Azure will unpack your application from the service deployment package (.cspkg file) and install it into each instance. Internet Information Server (IIS) will be started, where it will be connected to a load balancer handling traffic for the URL you configured for your service. Your service is then live.

Recovery in Windows Azure Compute

If at any point in time, one of your deployed instances fail, whether due to hardware or software failure, Windows Azure will detect this and immediately deploy a new instance to replace it.  It does this by retrieving the service deployment package (.cspkg) and Service Configuration (.cscfg) file from storage and repeating the exact same process as described above for the initial deployment.

The key thing to remember here, is that Windows Azure will always start from scratch with a ‘vanilla’ Windows Server VM, and then deploy your application into it based on the contents of your service deployment package and service configuration file.  Any changes made to the application, or by the application, on a running VM instance after the initial deployment are not persisted or available in new instances that are brought online for recovery purposes.

Elasticity in Windows Azure Compute

Elasticity is one of the key benefits of Windows Azure and cloud computing.  If a deployed application requires more power to meet increased load, new instances can be added to an existing deployment to handle it.  Upon receiving a command or configuration change to increase the instance count, Windows Azure will deploy extra instances following the same exact procedure as described earlier for the initial deployment.

Any changes made to the application, or by the application, on a running VM instance after the initial deployment will not be available in any new instances that are brought online to meet demand.

If the load on a deployed application with multiple instances decreases, instances can be taken offline to reduce resources and costs. When a request to reduce the instance count is received by Windows Azure, Windows Azure decides which instances to remove. This means, you have no way to control which instance(s) will be removed.

‘Stateless’ Virtual Machines

The net of takeaway of understanding deployment, recovery, and elasticity in the Windows Azure Compute environment is that the VM instances your application runs in are stateless by design. This is what enables elasticity, quick recovery, and scalability in the cloud.

Now that you understand how the compute environment of Windows Azure is based upon stateless VMs, that will lead to the list of ASP.NET application migration concerns compiled here below.

Top 7 List of Migration Concerns 1. Handling Storage

Given that the VM instances that run your application are stateless, handling storage is one of the primary migration considerations you must account for.  Data can be stored locally in your application’s VM or external to the VM in storage services available within Windows Azure.  Windows Azure provides both relational and non-relational storage services. 

Windows Azure provides non-relational storage in the form of blobs, tables, and queues. These three storage mechanisms are collectively known as “Windows Azure Storage”.  Relational storage is available via SQL Azure, which is SQL Server technology delivered as a service. 

The key difference with storage in the cloud is that it is provided “as a service”.  That is, you will not need to set up, install, or maintain an actual database server.  These things are managed for you and provisioned via the Windows Azure Management Portal where you can then access them within your ASP.NET application via traditional methods.

Using Local Storage

In a Windows Azure Web or Worker Role VM, your application has access to read and write to the local storage. However, given the stateless nature of VM instances in Windows Azure, local storage is transient by design.  Therefore, data that needs to be durable must be stored externally from the VM instance.

Data stored on the local drive of a VM instance will survive OS re-boots, but not hardware failures.  Data on the local drive is not synced with the drives of other VM instances of your application.  Likewise, new instances (added for capacity or restoration of failed VMs) will not have access to data persisted to local storage.  Data on the local drive does not survive if an application deployment is deleted from Azure, and then later re-deployed again.

If your application does depend on the local drive for durable storage, you will need to plan for moving that data to either Windows Azure Storage or SQL Azure.  Some examples of where an existing ASP.NET application may use local storage include writing dynamic data to an XML configuration file or storing images and other media content that may be uploaded to the application, like in a CMS system. These examples would be candidates for moving to Windows Azure blob storage.

Local storage can be used for temporary data that your application would have no issue re-generating or working without on a re-start.

For more information about Local Storage in Windows Azure WebRoles and WorkerRoles, see: How to Configure Local Storage Resources

Using SQL Azure

For ASP.NET applications that have been designed to scale over multiple servers in a web farm, the transient nature of local storage shouldn’t present a major challenge. In these types of applications, the data is typically stored externally from the application in a relational database such as SQL Server. In a typical web farm deployment, you may have multiple web servers running your application all sharing a common database server.  This model works well in Windows Azure as your relational data should be able to migrate from SQL Server into SQL Azure.

When migrating an ASP.NET application into Windows Azure, one of the steps you must take early on is to configure a SQL Azure server instance and migrate your existing databases to it.  This typically includes any custom databases you have, as well as the standard ASP.NET database for Membership and Profile data.  Once these databases have been set up in SQL Azure, it is only the connection string that needs to be changed in your application’s configuration.

While developing your application locally, you will continue to use SQL Server Express as per usual. In this case, you will often find it helpful to keep different versions of your web.config file handy in your project for local development and production cloud deployment.

SQL Azure offers a subset of SQL Server’s features and functionality. Some elements of your application’s custom database may not be compatible. Using tools such as the SQL Azure Migration Wizard will help you discover any such incompatibilities so you can plan around them.

For more information using SQL Azure with ASP.NET, see Rachel Appel’s forthcoming post. (Coming soon!)

Using Windows Azure Storage

For easy migrations with little or no code changes, migrating your ASP.NET application’s data to SQL Azure is usually a great fit.  If you’re like most ASP.NET developers, you may be asking, “Why should I care about these new storage mechanisms in Windows Azure Storage like blobs & tables?”.  If your ASP.NET application is a typical CRUD-like application with lots of data driven forms, you might not need to deal with Windows Azure Storage when first migrating your application to Windows Azure.

If your ASP.NET application does make use of the local file system for durable data (such as dynamically editing XML configuration files) as described in the previous section, you will need to relocate that data to Windows Azure Storage.  Blob storage is a great alternative to local storage for reading and writing files to.

As you optimize your application, it is a good idea to store static content such as script files, CSS style sheets, and images in Blob storage.  These static files can be served directly by the web server in your application’s VM.  However, by moving them to Blob storage, they are served to your users directly by the Windows Azure Storage service.  This has the benefit of reducing the load on your web server(s) and also enabling you to later take advantage of Windows Azure’s Content Delivery Network (CDN).

For more details on using Windows Azure Storage with ASP.NET, see the next post in this series by Adam Hoffman, “Blah Blah Blah”.

2. Mapping ASP.NET Applications to Windows Azure Roles

In my previous post in this series, I wrote that the Windows Azure Tools for Visual Studio include a Windows Azure Service project type to define a hosted service.  This project is essentially a “meta” project that lets Visual Studio know how to package your application for deployment to the cloud and configure Windows Azure to run your application.

The tools also contain templates for WebRole and WorkerRole project types.  The WebRole project type contains the actual ASP.NET application to be deployed as a hosted service in Windows Azure.  The tools contain variants of the WebRole project type for each of the ASP.NET application types including WebForms, MVC 2, MVC 3, and MVC 4.

Creating a new WebRole project for any of the ASP.NET application types will essentially create a project with the structure as the existing ASP.NET project template types.  When the WebRole project is created, the tools add the appropriate configuration settings to the Windows Azure Service project to link the two.  You can add up to five WebRole projects to a single Windows Azure Service project.

In Visual Studio, you can also convert an existing ASP.NET Web Application project to a WebRole project by adding a “Windows Azure Deployment Package”.  This will create a Windows Azure Service project, convert your ASP.NET application project to a WebRole project, and link the two.  This is more likely the scenario most developers will use when migrating an existing application to Windows Azure. 

For an example of how to converting an existing ASP.NET Web Application project to a WebRole project in Visual Studio, and how to create a new ASP.NET WebRole project see: Walkthrough: Hosting an ASP.NET MVC Application on Windows Azure.

Note: The Windows Azure Tools for Visual Studio do not support converting an ASP.NET Website to a WebRole project.  It is possible to package an ASP.NET Website for deployment to Windows Azure, but the tooling experience is not great, essentially limited to command line calls and manual assembly of the required configuration files.  For more information, see David Aiken’s post: How to Deploy an ASP.NET web site to Windows Azure! Or, see: Website Projects in Azure Web Role on

Understanding WebRole Projects

Whether you create a new WebRole project from scratch, or convert your existing ASP.NET Web Application project to a WebRole project, there are three sets of things that will be added to your project:

  1. References to three Windows Azure assemblies: Diagnostics, Service Runtime, and Storage Client.
  2. A WebRole.cs or WebRole.vb file.
  3. A trace listener in the web.config file to enable Windows Azure logging and debugging.

The Windows Azure Diagnostic assembly contains the classes for logging and diagnostics.  The Windows Azure Service Runtime assembly contains classes for accessing configuration settings and managing the lifecycle of the role (VM) that your application runs in.  The Windows Azure Storage Client assembly contains the classes for accessing Windows Azure Storage services (Blobs, Tables, and Queues).

WebRole.cs (or .vb) Bootstrapping Code

The WebRole.cs (or .vb) file is a magical place where you can set up all sorts of advanced tasks and options. You will likely pay little attention to it when building your first “Hello World” ASP.NET application for Windows Azure, but over time, you may find yourself revisiting the classes in this file. 

You can think of WebRole.cs as the “Global.asax” file for the cloud.  Inside is a class called ‘WebRole’ which extends Windows Azure’s RoleEntryPoint class. This class contains methods that are called by Windows Azure to manage the lifecycle of your web role (starting, running, changing, stopping, etc).  For details on the lifecycle events and their order with respect to the ASP.NET applications events handled in Global.asax, see Jim Nakashim’s post: Windows Azure RoleEntryPoint Method Call Order.

One of the most common tasks performed in the extended RoleEntryPoint class is to initialize Windows Azure diagnostics and logging at start up. Other things you can do include responding to configuration changes, such as the scaling up or scaling down of instances, and handle shut down tasks for the web role.  We will have more coverage on those topics later in the series.

Troubleshooting Tip:  If your role is recycling between the initializing, busy, and stopping states, this may be the result of something going wrong at startup time.  A good place to poke around and troubleshoot is in the RoleEntryPoint class.  If any of the methods in the RoleEntryPoint class raise an unhandled exception, the web role (VM) will be shut down. Windows Azure will then automatically attempt to re-start the role. For tips on how to break the cycle and troubleshoot, see: Troubleshooting Hosted Service Deployment States on MSDN.

For more information on WebRole.cs and the RoleEntryPoint class, see: Overview of Building an Application that Runs in a Hosted Service on MSDN.

For tips on how you can use the RoleEntryPoint, see Brent Stineman’s post: Leveraging the RoleEntryPoint.

3. Application Dependencies

A common hiccup that can occur when you are first migrating your ASP.NET application to Windows Azure is not including dependent assemblies.  The Windows Azure compute environment includes the .NET Framework (3.5 and 4) as well as the Windows Azure SDK assemblies.  However, it does NOT include other 3rd party or Microsoft frameworks such as those obtained via NuGet.  For example, the Microsoft Enterprise Library, or out-of-band releases for the .NET Framework such as the ASP.NET MVC framework are not included in the Windows Azure compute environment. 

Luckily, the WebRole project templates in the Windows Azure Tools for Visual Studio automatically include the ASP.NET MVC (versions 2, 3, or 4) framework assemblies in your application’s deployment service package (.cspkg file).  However, if your application depends on other frameworks or components, you must add those assemblies to your application’s deployment service package.  You can do this by:

  • Setting the Copy Local property to True for each referenced assembly in your project that is not part of the Windows Azure SDK or the .NET Framework.
  • Ensuring the web.config file does not reference any unused assemblies in the compilation element, and all references point to assemblies that are either part of the .NET Framework or the Windows Azure SDK, or that have their Copy Local property set to True in Visual Studio.

For more tips on verifying application dependencies in Windows Azure, see: Troubleshooting Hosted Deployment States on MSDN.

4. Session State

Many ASP.NET applications use ASP.NET’s Session State feature to track things such as the state of a user’s shopping cart or their profile information. Session state is a powerful feature of ASP.NET that brings the appearance of state to an environment that is stateless.

ASP.NET Session State Providers

The session state feature in ASP.NET uses a provider model that allows you to configure how session state is stored in your environment. There are three session state providers included with ASP.NET out of the box:

  • In-process memory provider
  • State server provider
  • SQL Server provider

The most frequently used provider is the in-process memory provider, which stores the state in the memory of the web server it is running on. It relies on the load balancer configured for ‘sticky sessions’. Since the Windows Azure load-balancers are non-sticky, you can not use this provider.

The state server provider allows you to point your session state at a server that is dedicated to hosting state data in its own memory. In Windows Azure, this would require you to configure, run, manage, and pay for another WebRole specifically as a state server. That would not be economical as a state server would likely need a larger VM size to take advantage of extra memory.

The SQL Server provider does as you would expect, it stores state data in a SQL Server database. In this scenario, all the servers in web farm could point at the same database for session state, allowing user requests to be served across the farm. The SQL Server provider works just fine in Windows Azure if you point it to a SQL Azure database. However, storing session state in a database can add latency when retrieving state on each user request.

Windows Azure Session State Providers

There are two provider options available to store session state in Windows Azure. These are the Windows Azure Cache provider and the Windows Azure Table Storage provider.

The Windows Azure Cache provider is a great solution for managing ASP.NET Session state in Windows Azure. This provider was introduced recently in December 2011. It uses the Windows Azure Cache service to store session state. The Windows Azure Cache service is a distributed in-memory caching service. High performance is achieved by maintaining this cache in-memory across multiple cache servers.

The Windows Azure Cache provider requires ASP.NET 4, which means your projects must be compiled against the full version of the .NET 4 Framework. This may be a limitation for those who are on .NET 3.5 and earlier.

For more details on how to use the Windows Azure Cache provider, see: Using Windows Azure Caching for Session State

The Table Storage Session provider stores session state in Windows Azure Table storage. This provider is provided as sample code by the Windows Azure team. This provider appears to be more of a proof of concept vs. something you should use in production. The sample code does not clean up expired sessions, so the table size can continue to grow. However, it is a nice solution in concept as session state is stored in a high-scale storage service backed by triple redundancy.

5. Identity & Authentication In The Cloud

Handling identity and authentication is a common thing most ASP.NET applications do. One of ASP.NET’s best features is its provider-based Membership and Profile services. When combined with Forms Authentication, these two services make for a simple model to handle authentication and identity on your website. With the Membership and Profile services’ dynamic providers, user data can be stored in different locations. It is most common that this data be stored in SQL Server using the SQL Membership provider.

When migrating an ASP.NET application to Windows Azure, you can migrate the membership and profile data to SQL Azure. These standard ASP.NET databases should migrate just fine to the cloud. This means that Forms Authentication in Windows Azure “just works” using the existing SQL Membership provider. The exception to this would be if you created a custom membership and profile database that uses features not supported in SQL Azure.

For corporate and Intranet websites, it is common for ASP.NET applications to use Windows Integrated Authentication. In this scenario, if a user is logged into their desktop, their Windows identity is transferred to the web application. The user is essentially authenticated with the web application without knowing it.

Windows Authentication is not available “out of the box” in Windows Azure as it requires the web server to be part of the domain the users belong to. With your ASP.NET application running in a Windows Azure datacenter, the web server certainly won’t be part of your company’s corporate domain! Windows Azure provides a service called Access Control Service (ACS) which can help bridge the gap.

ACS is an authentication service in the cloud that enables you to set up a trust relationship between Windows Azure and a secure token server (STS) in your company. This concept is called Federated Identity. With ACS configured, users can log into your ASP.NET application seamlessly using their corporate domain credentials.

When migrating a corporate application that depends on Windows Authentication, you will need to configure Windows Azure’s Access Control Service with your company’s secure token server. Most companies use Windows Server Active Directory Federation Services V2 for their STS.

ACS also enables you to allow users to login with many popular identity providers such as Windows Live ID, Google, Yahoo, Facebook, and Open ID 2.0.

Sound confusing? If ACS, STS, and WSADFSV2 sound like crazy acronym soup to you, have no fear! We will be covering how to handle identity with Windows Azure’s Access Control Service in a forthcoming post in this series. (Which will eventually be linked from here.)

6. Handling Configuration

Most ASP.NET applications use the web.config file to store all of their run time configuration settings. Administrators of ASP.NET applications are used to having the ability to make configuration changes to this file while an application is running.  Changes to the web.config file will trigger a restart of the application within IIS.

In Windows Azure, the web.config file is deployed as part of your application’s service deployment package.  It lives within the VM instance that your application runs in. Due to the stateless nature of these instances, changes to the web.config file on a running instance is not allowed.  This is because if changes were made:

  1. They wouldn’t be synchronized across all of the instances in the role.
  2. The changes would not be available to new instances spun up for elasticity or recovery.

Changes to the web.config file require a new deployment service package to be created, and a new deployment to be pushed to Windows Azure.  If this is not an acceptable limitation, you can migrate your configuration settings to the hosted service’s ServiceConfiguration.Cloud.cscfg file in your Windows Azure Deployment Project. 

Like web.config in a regular Windows Server environment, settings in this file can be edited at runtime too.  Changes to ServiceConfiguration.Cloud.cscfg will also trigger a restart of your application within IIS, causing the new settings to be applied.  This also has the benefit of applying the changes across all of the role instances that are running your application.  Your configuration is now located in a central location relative to all of your role instances.

To move configuration settings to the ServiceConfiguration.Cloud.cscfg file, you will need to add a small bit of code to the RoleEntryPoint class in the WebRole.cs (or .vb) file to handle both the loading of these settings, and changes when the ServiceConfiguration.Cloud.cscfg file is updated.

For more details on how to store and retrieve custom configuration settings in the ServiceConfiguration.Cloud.cscfg file, see the following resources:

There are trade offs if you take the approach of putting your application’s settings in ServiceConfiguration.Cloud.cscfg.  In exchange for having the ability to easily apply configuration changes across all of your instances while running, your application code now takes a dependency on Windows Azure. You will also need to write the code to retrieve settings from ServiceConfiguration.Cloud.cscfg.

In general, it is probably best to move only settings that you expect the administrators of your application to change frequently while in production. For settings that don’t change frequently, keep them in web.config and manage the changes via upgrade deployments.

7. IIS Configuration Differences

When your ASP.NET application runs in an Windows Azure WebRole, it is hosted using IIS 7.0.  Being hosted in IIS 7.0 means your application has access to the full range of web server features available in an regular Windows Server installation.  This includes useful things such as support for multiple sites or virtual applications and activation of WCF services over non-HTTP transports through Windows Activation Services.  For more information on the IIS features available in Windows Azure, see: New Full IIS Capabilities: Differences from Hostable Web Core.

Advanced configuration of IIS components and features can be managed in the ServiceDefinition.csdef configuration file of your application’s Windows Azure Service project.  Multiple websites can be configured directly in the ServiceDefinition configuration file. Other IIS settings can be configured by generating a CMD file script and running it as a startup task.

To learn how to generate a CMD file script to configure IIS, see: Using Configuration Editor: Generate Scripts

To learn how to configure IIS components via start-up tasks, see: How to Configure IIS Components in Windows Azure.

Multiple ASP.NET Applications in a Single WebRole

The default way the Visual Studio tools work is to configure one ASP.NET application per WebRole. That is, each ASP.NET application will be configured to run in its own dedicated virtual machine in the cloud. By taking advantage of the sites, applications, and virtual directories features in Internet Information Services (IIS) 7.0, it is possible to host more than one ASP.NET application in a single WebRole. This is a more complex configuration that involves trade offs.

While you gain the economic convenience of hosting two sites in a single WebRole, you give up the ability to independently manage some aspects of those applications, such as whether or when to scale up or down to more role instances. Also, Windows Azure does not impose a security boundary between the sites and applications that are running within the role. This can have implications when you are considering the security of the individual sites.

On a regular server, multiple sites are managed by configuring host headers in the web.config file.  In Windows Azure, you will essentially set this up by doing the same in the ServiceDefinition.csdef file.

For more information, see: How to Configure a Web Role for Multiple Web Sites on MSDN or Brian Hitney’s post: One Azure Role, Multiple Websites.


There you have it… a collection of top migration concerns when migrating an ASP.NET application to Windows Azure.  This list is by no means comprehensive, but should provide you with enough information to move beyond “Hello World” and help you plan for getting your application deployed to the cloud.

Now that you understand the type of work needed to migrate an existing ASP.NET application to Windows Azure, it’s time to learn about the new storage mechanisms in Windows Azure (blobs, tables, and queues, oh my!).  Read the next post in this series by Adam Hoffman: Windows Azure Storage for the ASP.NET Developer 

For the rest of the posts in this series, see “Windows Azure for the ASP.NET Developer” on US DPE Azure Connection.

Are you a startup? Get BizSpark cloud access.  Got MSDN? Get up to $3,700 of cloud benefits.  Don’t have MSDN?  Try the cloud free for 90 days!

Cohacking in Princeton

Ancora Imparo - Scott Watermasysk - April 24, 2012 - 10:18am

I have worked at home for most of the last 8 years. One of the things I try to do is get out of my home office once or twice a week.

I attended my first Princeton Tech Meetup last night. One of the things that really impressed me was the number of people who attended (nearly 100 in just month #2). In addition, I was equally impressed with the number of people who were starting business (or looking to start companies).

With no local co-working facilities, I was thinking it might be a good idea to try to setup ‘shop’ once or twice a week in Princeton.

So for the next couple of weeks, I am going to start working at the awesome Small World Coffee on Thursdays (say 10 am to 4 pm).

It is open to everyone, but you will probably get the most out of it if you are in one of the following buckets:

  • Entrepreneur (or want to be one)
  • Enjoy building new things
  • Developer/Hacker/Designer (or some other creative)

If you are semi-local, please feel free to stop by (also feel free to ping me at to make sure I will be there :).

In addition, if you are looking at starting a new business and want to talk to someone about how to simply get started, please stop by.

Vim Tip: Past Commands

Ancora Imparo - Scott Watermasysk - April 19, 2012 - 11:17am

This week’s, how the hell did I not know about this sooner vim moment: q:.

I primarily use vim via terminal these days. One of the nice things in MacVim is the ability to arrow through previous commands (just ‘:’ then up and down arrows). Since arrows do not work (which is kind of great) navigating and reviewing recent commands didn’t appear to be easily possible….and of course, I was really wrong. :)


  1. q: - brings up recent commands
  2. Select a line you want to run
  3. Remember that you can edit the line in place
  4. Execute the command with Control+C (capital C).

Here are some good docs on Using Command Line History.

Support, Support, and More Support

Ancora Imparo - Scott Watermasysk - April 19, 2012 - 11:04am

If we ever move hosts on the KickoffLabs Blog I am pretty sure I know where we are going.

Great Mixergy interview of Jason Cohen (founder of WP Engine).

Lot’s of great parts (see Robert Bazinet’s blog post on the interview). The thing that jumped out to me most is his philosophy on support which is essentially: just make the customer happy.

This very much matches up with our approach to KickoffLabs.

Technology and features are great, but they are easily copied and duplicated. You cannot (in the long term) fake caring.

Not A 501 Developer

Ancora Imparo - Scott Watermasysk - April 19, 2012 - 9:59am
Not A 501 Developer:

You see, programming isn’t a job for me…it’s a passion. I contribute to open source projects, not because I am awesome, but because programming is awesome. Think about it: with a computer, you have the power to make almost anything you want, as long as you can think out the logic.

In the short term, you always need to do what’s best for your family/etc. However, in the long term you are missing something awesome if you are wasting your time doing something you don’t love for a career.

If writing software is simply a means to to an end you are missing a major opportunity to really enjoy life.

Take the Rock Paper Azure Challenge: Spring Fling Edition

JrzyShr Dev Guy - April 18, 2012 - 1:25pm

I’m excited to announce that the Rock Paper Azure Challenge is back again for a spring fling!  If you want to learn about Windows Azure and have some fun doing it, your opportunity is here.  With a free 90-day trial, anyone who lives in the US (who is not a Microsoft employee) can take the challenge!

The Spring Fling round of the Rock Paper Azure Challenge is open starting this week and runs through June 15, 2012!  Each week on Friday at 2pm, the top three “bots” will receive Best Buy Gift Cards ($50, $25, and $10).  If you’re bot has staying power, you can win week after week!

To keep it interesting for all players, there will be three sweepstakes prizes awarded at the end on June 15, 2012 to randomly drawn entries in the Spring Fling round. All you have to do is get in the game for a chance to win:

What is the Rock Paper Azure Challenge?

I first announced the Rock Paper Azure Challenge here back in April 2011.  The RPA Challenge is a fun way for developers to learn about Windows Azure and possibly win a few prizes along the way.  In short, you get to code a “bot” that will play the childhood game of “Rock, Paper, Scissors” against other contestants’ bots.  The game allows you to flex your coding skills by rewarding developers for coming up with the best best “bot” algorithm.

Now is the time to get in the game and code your best bot!

Get started with the “Get Started” page on the Rock Paper Azure Challenge website.  This page has links to the downloads and screencasts that step you through the Bot coding process:

Get Started with Rock Paper Azure

Good luck this time around!  And if you have any questions, post them here or e-mail us at rockpaperazure AT

Azure, Mobility, and the Enterprise: NYC Windows Azure User Group 4-18-2012

JrzyShr Dev Guy - April 17, 2012 - 3:05pm

Tomorrow is the April meeting of the NYC Windows Azure user group.  The group has been picking up the steam throughout the winter with talks by myself on the Azure Platform and Jim Priestley on Real World Azure Solutions.  Tomorrow night, we’re following it up with Ira Bell discussing Azure and mobility.  Mobile is the hot topic these days whether it’s tablets, phones, or other devices on the go.  Having the cloud tie these things together is enabling all sorts of new user experiences. 

Join us Wednesday evening, April 18th, 2012, for Ira Bell’s talk:

"Azure, Mobility and the Enterprise"

Mobility is at the forefront of strategic initiatives in the enterprise. Connecting people and information across a growing number of devices and systems can be a complex undertaking. Ira Bell will explore how organizations can use Azure to accelerate mobile development.


The NYC Windows Azure User Group meets at the Microsoft NYC Office in mid-town Manhattan at 6:30pm.  The address is 1290 Ave of The Americas, NY, NY 10104.

Time to Learn How To Build a Windows Phone App? HackReady.Phone Webcast Series Is Here To Help!

JrzyShr Dev Guy - April 17, 2012 - 10:18am

If you have been thinking about writing a Windows Phone App but didn’t know where to start my fellow teammate, Dani Diaz, has got something for you!  He’s been hosting a webcast series that started on April 3rd.  There are still three left in the series that you can catch live. But via the links below from Dani, you should be able catch the recordings of the previous ones!

Via Dani

Join us for HackReady, the new online learning series designed for developers to bring you the vital bits you need, without the fluff you won’t miss. Full of key information and demonstrations, this series gives you a solid understanding of the tools, techniques, and resources you need to become HackReady.

The HackReady.Phone series brings you seven episodes, from start to marketplace. Whether you are a new Windows Phone developer thinking about your first app or well on your way to publishing, these sessions help you get there. Join us for one or the whole series—pick and choose as you like.

(Tue 4/3 10AM PST)
MSDN Webcast: HackReady.Phone, Episode 1: Introduction to the Windows Phone Platform (Level 100) -

(Thur 4/5 10AM PST)
MSDN Webcast: HackReady.Phone, Episode 2: Working with Internal and External Data in Windows Phone (Level 200) -

(Tue 4/10 10AM PST)
MSDN Webcast: HackReady.Phone, Episode 3: Understanding Windows Phone’s Application Lifecycle and State Management (Level 200) -

(Thur 4/12 10AM PST)
MSDN Webcast: HackReady.Phone, Episode 4: Working with Windows Phone Sensors and Other APIs (Level 200) -

(Tue 4/17 10AM PST)
MSDN Webcast: HackReady.Phone, Episode 5: Enhancing the User Experience and App Usability with Live Tiles, Push Notifications, and Background Agents (Level 200) -

(Thur 4/19 10AM PST)
MSDN Webcast: HackReady.Phone, Episode 6: Enhancing Performance and Application Testing (Level 200) -

(Tue 4/24 10AM PST)
MSDN Webcast: HackReady.Phone, Episode 7: Ready, Set, Publish: Everything You Need to Know About Releasing Your Apps (Level 200) -


Ancora Imparo - Scott Watermasysk - April 17, 2012 - 8:51am

Don’t you hate OSX’s launchctl? You have to give it exact filenames. The syntax is annoying different from Linux’s nice, simple init system and overly verbose. It’s just not a very developer-friendly tool.

With Lunchy you can start and stop services with ease. Example:

lunchy start redis

Tip. If you use ZSH and want to stop seeing this message:

zsh: correct 'lunchy' to 'launchy' [nyae]?

You can add this alias:

alias lunchy='nocorrect lunchy'

Start with RDBMS

Ancora Imparo - Scott Watermasysk - April 13, 2012 - 10:05pm
Start with RDBMS:

we recommend using PostgreSQL (or some traditional RDBMS) first, then investigating other solutions if and when you find them necessary

Age-old advice: don’t worry about scaling until you have scaling issues.

Microsoft Store Coming to Freehold & Bridgewater in New Jersey!

JrzyShr Dev Guy - April 12, 2012 - 12:00pm

On March 15th, the Microsoft Store announced they are opening new stores in New Jersey!  The two newest stores will be in Freehold, NJ at the Freehold Raceway Mall and in Bridgewater, NJ at the Bridgewater Commons Mall.

You can read the news in the Jersey Shore’s paper of record: The Asbury Park Press

I was at the Freehold Raceway Mall this past weekend, and the temporary store front looks great!

For anyone that uses Microsoft products (pretty much MOST folks!), it will be great to have these new stores in the area finally!  If you haven’t heard about the Microsoft Store, learn more by visiting their website.  The Microsoft Store makes it easy to buy software from Microsoft and Microsoft partners in an environment where the folks know what they’re talking about. 

If Aunt Betty needs a new copy of Office for her PC, she can hop over to the mall and pick one up while shopping.  Want to check out the XBox Kinect in action and get the latest video game accessories?  Considering the hot new Nokia Lumia 900 Windows Phone that just came out this week?  These will all be things you can do at the Microsoft Stores when they arrive here in Jersey!

The best thing about these stores, is that if you’re looking for a new PC (whether it’s a laptop, slate, or desktop), EVERY PC sold comes with “Microsoft Signature” on it!  What is that?!  Have you ever purchased a new computer that was loaded with trial-ware and sample software that just slows the machine down?  Yeah… I think we all know that experience.  With Microsoft Signature, you get a PC with no extra “junk” that is tuned to run with the best performance the moment you start it up for the first time!

If you ever have a problem with a PC purchased at the Microsoft Store, you’ll be able to take it to there and get someone to help you out.

That alone is one of the things I’m most looking forward to when these stores open!  For now, we’ll have to wait.  Until then, visit to keep up on the latest information, including opening dates when they are announced!

@home with Windows Azure Webcast: Async Patterns For The Cloud

JrzyShr Dev Guy - April 11, 2012 - 10:00am

Tomorrow (Thursday, 4/12/2012) at noon ET (9am PT) we have our fifth screencast in the @home series: Async Patterns In The Cloud!

During the first week of March 2012, my teammates Brian Hitney, Jim O’Neil, and I announced the re-launch of the @home with Windows Azure project. On March 15, we hosted a kick-off webcast providing an overview of the project.

This is the fifth in a series of five where we are diving into various aspects of Windows Azure.  In this fifth webcast, we’ll explore various patterns for how you can build a scalable application in Windows Azure.  From the abstract page:

In our fourth webcast about Windows Azure, we look more deeply at scalability in Windows Azure and how to use queues to effectively scale applications both up and out. We also take a look at the Windows Azure Auto-Scaling Application Block (WASABi) to help with autoscaling and using performance counters to monitor applications.

WATCH THE WEBCAST at 12:00pm EDT 4/12/2012

If you can’t make this one, be sure to check out the recordings of this one, and the rest of the series at the @home with Windows Azure website. The recordings should be available within a few days from the webcast.

What is @home with Windows Azure?

Microsoft provides a 90-day free trial of Windows Azure where you can learn to kick the tires and run an application in the cloud 24x7 cost-free.  The @home with Windows Azure project is an online activity where you use those 90-days of free compute time(or your MSDN Subscriber benefits) to contribute to Stanford University’s Folding@home distributed computing project.

The Folding@home project helps scientists provide insight into the causes of diseases such as Alzheimer’s, Mad Cow disease, ALS, and some cancer-related syndromes, by running protein folding simulations on thousands of machines world wide,

You deploy Stanford’s Folding@home application to Windows Azure, where it will execute protein folding simulations in the cloud, thus contributing to the research effort. In essence, your participation is a donation of your free compute time to the Folding@home project!

Additionally, from the start of March 2012, Microsoft is donating $10 (up to a maximum of $5000) to Stanford’s Pande Lab for everyone that participates!

You can learn more about the project and sign up to view a series of web-casts we will be delivering over the next month at the project’s website:

@home with Windows Azure

Hope you will join Brian, Jim, and I tomorrow!

Andrew Brust is now Big On Data

JrzyShr Dev Guy - April 10, 2012 - 12:00pm

Yesterday, I posted about Visual Studio Live! and the new discount offer available from Andrew Brust.  Today, I wanted to let folks know about one of Andrew’s newest adventures.  Many folks here in the New York metro area know Andrew Brust as the co-leader of the NYC .NET Developers Group.  Andrew started that group a long long time ago with Stephen Forte and Bill Zack.  Andrew is also the leader of the NYC MS Business Intelligence User Group.  He’s known throughout the greater Microsoft community in the US via his participation in Microsoft’s Regional Director program.

For those of us into cloud computing (like myself), there’s been a lot of buzz and focus around the emerging technologies of “Big Data”.  What is “Big Data”?  Well, besides being the latest buzz word (like “Web 2.0” or “SOA”), it generally is a reference to managing and making sense of large quantities of non-relational data.  If you follow technologies like NoSQL data stores (Azure Table storage, MongoDB, Cassandra, etc) and Hadoop, then you already know what “Big Data” is all about.

Andrew has always had a focus on data-related technologies, especially around data analysis and business intelligence. It seems only natural that “Big Data” would be a hot topic that gets his technology passion going.  I’m happy to share that Andrew is now authoring the new “Big on Data” blog at ZD-NetAndrew is now part of a team of well-known and respected technology bloggers including Mary Jo Foley, Larry Dignan, Jason Perlow, and Ed Bott amongst many others.

For keeping up with the latest trends around Big Data, I recommend Andrew’s new blog:

Big on Data @ ZDNET

Formal bio for Andrew:

Andrew J. Brust has worked in the software industry for 25 years as a developer, consultant, entrepreneur and CTO, specializing in application development, databases and business intelligence technology. He has been a developer magazine columnist and conference speaker since the mid-90s, and a technology book writer and blogger since 2005. Andrew is also Founder and CEO of Blue Badge Insights, an analysis, strategy and advisory firm serving Microsoft customers and partners.

Syndicate content