Using MVC3 and I\'d like to determine if I am running locally or deployed to the cloud?
RoleEnvironment.IsAvailable tells you if you're running in Windows Azure, but it doesn't differentiate between the real Windows Azure and the local development simulator.
I wrote a blog post that shows a trick to figure out whether you're running in real vs. simulated Windows Azure, when RoleEnvironment.IsAvailable == true - hopefully that provides what you're looking for.
EDIT: In case you want the down-n-dirty code I describe in the abovementioned post, without any explanation of why the technique works:
private bool IsRunningInDevFabric()
{
// easiest check: try translate deployment ID into guid
Guid guidId;
if (Guid.TryParse(RoleEnvironment.DeploymentId, out guidId))
return false; // valid guid? We're in Azure Fabric
return true; // can't parse into guid? We're in Dev Fabric
}
EDIT 2: My answer is a bit outdated. There's now RoleEnvironment.IsEmulated, which is much more straightforward to use. MSDN documentation is here