Make Existing Projects Run in Azure

Disclaimer: This is not a tutorial on how to take an existing project and make it ‘just work’ in Azure. Depending on your existing project it may either be as easy as described below, or so painful that it’s not worth it. The goal of this post is simply to show how to make projects compatible with the Azure development fabric.

So you’ve got an existing project and are experimenting with making it run on the Azure platform. Do you.

A) Create new Azure projects and meticulously copy your code over?

B) Throw your hands up in defeat and tell your boss it’s too much work?

C) Add a few snippets of code to your existing projects and be a hero?

As it turns out, C is the correct answer! In the case of either a web application or a class library, you can easily turn them into web roles and worker roles, respectively. In order to do this, simply unload the project and add the appropriate XML to the project.

To make a web application project (including ASP.NET MVC) able to run as a web role, add the following.

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

To make a class library project able to run as a worker role add the following.

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Once you’ve made these changes and reloaded the project, you should be able to associate your cloud service project with an existing web or worker role!

Unload Project

Unload Project

Edit Project

Edit Project

Editing Project

Add XML

Reload Project

Reload Project

Associate Role

Associate Project

A Few More Tricks

Copy LocalAs I was working on this post I came across a few more tricks and undocumented nuances that cost me an unfortunate amount of time trying to figure out.

  • In order to run an ASP.NET MVC application under Azure, you’ll need to copy the System.Web.Mvc assembly local. This can easily be accomplished from the properties pane.
  • In web applications, you can not work with the RoleManager within Application_Start (see the remarks after the jump).
  • While you can make any class library a worker role, the development fabric will crash & burn if you do not have exactly one class in that assembly the derives from RoleEntryPoint.
in Blog | 545 Words

Windows 7 Beta – First Impressions

This weekend I wiped my system, and installed the freshly released beta of Windows 7 x64!

Why?

Why not? :) In hindsight, it may have been a bit irrational given that prior to today this system has been the most solid, stable, and enjoyable system I’ve ever worked with. I had been running Vista Ultimate x64, my very first daily-use Vista install, on fairly decent hardware for well over a year. It’s actually been so long since I’ve reinstalled the OS on my daily-use PC I completely spaced deauthorizing iTunes!

So what prompted the reinstall? After acquiring a copy of the PDC build, I installed it in VirtualBox, and the performance was unbelievable! Having experienced Vista in both the virtual and physical worlds, I’ve always felt like it depends on the Aero UI to feel snappy…it just didn’t feel quite as fast when virtualized or not using Aero. Yet this build of Windows 7 in its pre-beta state ran fast virtualized!

How’d It Go?

For the most part the experience has been pretty good. The install seemed to take an unusually long time compared to Vista…almost felt like the hardware wasn’t detected properly and hence not running at its best. This seems a bit strange since I’m running year old, fairly generic hardware. Unfortunately once I got to installing drivers, I found that the Intel chipset driver installation utility wouldn’t run due to ‘an incompatible OS’…I had to extract the zip file and manually install the drivers. Hopefully with the beta of Windows 7 publicly available Intel will update their driver package. The other hardware-related comment is that NVidia has Windows 7-specific drivers available through Windows Update.

Stability and performance have been nearly what I expected. Memory usage seems lower, and boot time seems faster. That being said, it hasn’t been a completely smooth experience.

  • When the system went to sleep for the first time it didn’t want to wake back up.
  • Connecting to Windows 7 via remote desktop is really, really slow and choppy, even on a fast LAN.

Software

For the most part the applications I use regularly installed and run fine. This includes Firefox 3, Foxit Reader 3, 7-Zip, BlackBerry Desktop, Launchy, Notepad++, Quicken 2009, TweetDeck, and the Windows Live applications. Both Silverlight and Flash run without any issues. For ISO mounting Virtual Clone Drive installed and works fine, and for antivirus I installed the free version of Avast! antivirus. All of my programming tools installed and run just fine – Visual Studio 2008, SQL Server Express, Tortoise SVN, ReSharper, & Visual SVN.

  • iTunes: This was by far the most frustrating part of this whole experience. The installer would continually hang after installing everything else included (QuickTime, Bonjour, etc.) but before iTunes. I finally got it to work by extracting the contents of the downloaded setup file, which contains the installation packages for the individual applications, and using the iTunes installer from there.
  • Google Chrome: Installed fine, but wouldn’t load any web pages. A simple Google search via Firefox brought me to a working solution. Turns out its an issue specific to the x64 version of Windows 7.
  • Skype: The latest beta of Skype 4 installs and runs fine…until you try to shut it down. If you log off, restart, or shut down with Skype running, it will crash, and sometimes Windows will prompt you that it can’t restart until Skype exits. Even if you close Skype by itself it occasionally crashes.

The New Taskbar

One of the most visible changes to Windows 7 is the new taskbar. For an excellent look at the new taskbar, as well as some of its issues, I recommend taking a look at Paul Thurrott’s Simple vs. Easy article. While there are definitely some strange usability issues with the new taskbar, I think Microsoft is very, very close to something very slick. I agree with Paul that in the default mode of ‘always combine taskbar buttons’ it isn’t entirely clear what is running, and that the ‘combine when full’ is more ideal. But that still doesn’t address the launching of new instances, which leads to the jump lists. I had found the jump list on my own via the right-click, but the click, hold, & drag up technique almost feels better.

One feature that Paul didn’t address in this context is what happens when you hold over one of the running applications. After a second or two, you get a little mini-view of the window…same as Vista. But if you hold over the mini-view, all the windows on your desktop become transparent except for the one you are hovering over!

Taskbar Hover

This, I believe, is the connection that has yet to be made…and Microsoft is so close! Paul points out that the taskbar was originally conceived address the problem of users ‘loosing’ open windows on the desktop – I problem that I often have as a developer who often times has many, many windows open at a time. In Vista, in addition to the taskbar and mini-views, you could also use the alt-tab, which shows only the icons and part of the window title, or the new win-tab, flip-3D eye candy, that does show the whole window, but at an angle. None of these things, however, work nearly as well as the hiding of all windows except one technique!

Think about it; they’ve got the new taskbar, and they’ve got this new hover behavior…how easy would it be to reduce the steps between mousing over the taskbar and simply hiding everything but what you are hovering over! Don’t flip it at an angle for the sake of eye candy…just show it, as is, by hiding everything else!

Final Thoughts

Overall I think this was a good thing. It gives me a chance to play with the latest and greatest, and it only cost me one authorized iTunes computer! Vista introduced the consumer to 64-bit computing, and over the last few years there have been many positive steps towards making hardware and software more compatible. Yet despite the state of Windows 7, most of the issues I encountered have been related to being an x64 OS.

That being said, I’m really excited for Windows 7. It is pretty much what Vista, an OS I very much enjoy using, that has been polished & refined. It’s already excellent performance is most certainly going to improve, applications and drivers will be updated (Intel and Apple, I’m looking at you!), and hopefully we’ll see some improvements to the taskbar, too.

in Blog | 1,143 Words