Debugging Azure: VS unable to attach debugger to the IIS work process

There was an error attaching the debugger to the IIS worker process for URL ‘http://127.0.0.1:5100/’ for role instance ‘deployment(21).WebRole.0′. Unable to start debugging on the web server. …

It’s always difficult to troubleshoot an issue by its symptoms. But sometimes you’ve gotta start somewhere.

Someone suggested to reinstall .Net 4 – I left that as the last resort.
Someone else suggested to do an aspnet_regiis – which I did and didn’t fix it.

What helped me was this:

"The web role is probably crashing before Visual Studio has a chance to attach to IIS.

Okay that’s a start.

The first thing that runs on my web role is either in the webrole.cs (which I didn’t touch) or global.asax. And interestingly enough I found the following:

protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();
    RegisterRoutes(RouteTable.Routes);

    // Create the tables
    CloudStorageAccount storageAccount =
        CloudStorageAccount.Parse(
        RoleEnvironment.GetConfigurationSettingValue("DataConnectionString")
        );

    storageAccount.CreateCloudTableClient().CreateTableIfNotExist(AccountDataServiceContext.TableName);
}

And interestingly enough, I got my connection pointing to my production Azure Table and I didn’t have internet connection at the time which cause it to break. The web role crashed at this point.

If you’re having a similar issue, check out what you’re launching on global.asax – most likely something funny happening there.


About this entry