Windows Azure Role Instances are Taking Longer Than Expected to Start

Today, I was trying to run my Windows Azure project locally and, after running the project in Visual Studio, it just sat there for a long time churning away and not displaying anything. After waiting for a while Visual Studio got bored and flashed the following warning:

Role instances are taking longer than expected to start. Do you want to continue waiting?

VS 2010 Windows Azure Role instances are taking longer than expected to start error.

After trying this a couple of times, restarting Visual Studio, and even trying to wait the dang thing out, I finally decided that something was wrong and needed further investigation.

It turns out, that one of the Role Startup Tasks we needed to install the Windows Identity Foundation Runtime in a Windows Azure deployment ended up killing our local role instances.

What we did

<Startup>
  <Task commandLine="Startup\IdentityGac.cmd" executionContext="elevated" taskType="simple"></Task>
</Startup>

How we fixed it

We simply changed the taskType from simple to background and our local role instances started working right away. Now, it's important to keep in mind that your deployment might need a simple taskType and might not work if you change it to background. That being said, if you might want to just change the taskType for your local deployments and keep it the same for when you deploy to the cloud.

<Startup>
  <Task commandLine="Startup\IdentityGac.cmd" executionContext="elevated" taskType="background"></Task>
</Startup>

And that's it. I hope that this helps if you are encountering this error. And, hopefully, you won't have to waste as much time on it as I did.

Creative Commons License

What do you think?