Feb 12
5
Two weeks ago I decided that it was time to learn Windows Azure development. I watched many Azure presentations and training videos on the Web, installed the SDK and samples, followed all the instructions, and immediately ran into a brick wall. Just after my Azure debug session was launched, I kept getting the following Visual Studio error message box:
“There was an error attaching the debugger to the IIS worker process for URL ‘http://127.255.0.0:82/’ for role instance ‘deployment16(36).HelloWorld.Azure.HellowWorld_IN_0′. Unable to start debugging on the web server. Could not start ASP.NET debugging…”
A screenshot of the error dialog is below:
When I tried to run an Azure project that used Azure storage with ACS, I’d essentially get the same error complaining about port 444 instead of 82. In these samples, Visual Studio had remapped port the http port 80 to 82, and the https port 443 to 444 to avoid conflicts with other applications. It should also be noted that these samples were really supposed to use http://127.0.0.1, but for some reason the Azure emulator was trying to open http://127.255.0.0 instead, and I had no idea why this was happening.
I spent many hours over multiple days trying to resolve this problem – re-reading the documentation, searching the Web, reading blogs, messing around with IIS, emailing Microsoft people, uninstalling and re-installing Visual Studio and other software – to no avail. I watched Scott Guthrie’s “.Net Windows Azure Introduction” video again and recreated his HelloWorld example step-by-step, pausing every few seconds to make sure I didn’t miss anything – and still got the above error. This got me thinking “If the Azure HelloWorld example doesn’t work with just a simple Web app, then something is seriously wrong with my installation”.
I was just about to reformat my hard-drive and start over with a clean installation of Windows 7 – a suggestion from many people on dev forums – when I finally stumbled on a solution. It seems that this problem exists because I am running the Windows Azure samples on a 64-bit version of Windows 7 Ultimate.
On one developer support site, someone had claimed that changing the default website’s Application Pool Advanced Settings in IIS to support 32-bit applications would resolve the problem – but it doesn’t. You actually need to change this setting for the running Azure Application Pool instance for your Web application and
- I was just too unfamiliar with Azure or IIS 7 to know that
- Scott Gu’s creating Azure HelloWorld video didn’t mention this – perhaps he was running on 32-bit Windows?
- Changing this setting in IIS during a debug session is an awkward workflow
I also didn’t understand that this was necessary at all because I misinterpreted something that Steve Marx from the Windows Azure team had said on Channel 9 – that setting IIS to support 32-bit apps could be used as a way to get Azure to work with classic ASP. Since I’m using ASP.NET, I assumed this wasn’t necessary and ignored trying this solution that would have saved me days of frustration.
Fortunately, Christian Weyer’s blog post about running 32-bit IIS applications in Windows Azure got me thinking that I should give it a try. Below is the info that Christian provided, plus additional details about exactly where to put the .cmd file and XML code mentioned.
- Create a text file named enable32bit.cmd with the following one-line command and Add this file to your Web project (e.g. the “HelloWorld” project):
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true - In your Azure project’s ServiceDefinition.csdef file, add the following XML at the top of the <WebRole …> code block:
<Startup>
<Task commandLine="enable32bit.cmd" executionContext="elevated" taskType="simple" />
</Startup>
Doing that fixed the problem for me and hopefully it’ll work for any of you who also have this problem. If this problem and solution are officially documented by Microsoft elsewhere, then I completely missed them. IMHO this problem is probably common and annoying enough that the solution should be emblazoned in bold red text on page 1 of the Windows Azure Installation Instructions document.
I’m really interested to find out if there’s a way to get IIS 7 or Visual Studio to enable support for 32-bit apps on Windows 64-bit by default, instead of needing to put this file and XML into every Azure Web solution (perhaps Scott Gu was using such a solution?). If you know how to do this, please add a comment below explaining what to do – thanks!.