Failed to attach debugger on Windows Azure Web apps troubleshoot
There is a common error sometimes when you try to start and debug a web site/web app on the Windows Azure Emulator that it’s caused for a couple of reasons that I will explain below. The error message is “There was an error attaching the debuger to the IIS worker process for URL <THE_URL> …”.
You’re trying to run a 32bit application on a 64bit machine, so the application pool on IIS also 64 bit, without having the Enable32BitApps flag on the application pool enabled. That will cause the application not to start at all and of course the debugger will fail to attach to the IIS process and you’ll get this message.
Enable the flag on the application pool. To do so, Open IIS Manager, go to the Application Pools, select the pool and then from the menu panel on the right, select “Advanced Settings”. There is an option “Enable 32-bit Applications”, set that to True.
It could be multiple other reasons under this rule that all sum up to “Your application doesn’t run correctly on IIS 7.5″. It might be configuration issues, it might be authentication issues, it might be anything that makes your web app fail to run properly on IIS 7.5. If you have such errors and you try to deploy the web app to the Windows Azure Compute Emulator then of course the website won’t start as it’s hosted under IIS 7.5 and the debugger will fail to attach to it.
Check if your website works “normaly” under IIS 7.5. Create a new WebSite that points to the application directory and see if it works properly when it runs under IIS 7.5. If it works there then it’s going to work on the Compute emulator as well.
This is very rare but it might happen so I just include it here. For some very rare conditions it might be that when you upgrade your Windows Azure SDK that, specially the old versions (1.3 and 1.4), there are some left overs of configuration on your machine. Those could be registry keys and environment variables.
Finding the registry keys it’s not easy. It might sound crazy but your only shoot at this is using ProcMon.exe from Sysinternals and see what kind of keys the emulator tries to access before it fails. As for environment variables, on Windows 7 you just have to go to “Computer”, right click open Properties then “Advanced System Settings” from the panel on the left and lastly “Environment Variables..”. Make sure you don’t have “fixed” machine wide environment variables which are like Rd* (RdRoleID, RdRoleRoot etc). This solution also works when the SDK “misbehaves” and the RoleEnvironment class properties don’t work correct locally, among other things. After deleting those, you’ll need a full system restart.
Hope it helps,