Using MVC3 and I'd like to determine if I am running locally or deployed to the cloud?
This is what I use
public static class Azure
{
private static bool m_IsRunningAzure = GetIsRunningInAzure();
private static bool GetIsRunningInAzure()
{
Guid guidId;
if (RoleEnvironment.IsAvailable && Guid.TryParse(RoleEnvironment.DeploymentId, out guidId))
return true;
return false;
}
public static bool IsRunningInAzure()
{
return m_IsRunningAzure;
}
private static bool m_IsRunningAzureOrDevFabric = GetIsRunningInAzureOrDevFabric();
private static bool GetIsRunningInAzureOrDevFabric()
{
return RoleEnvironment.IsAvailable;
}
public static bool IsRunningInAzureOrDevFabric()
{
return m_IsRunningAzureOrDevFabric;
}
}