Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine if app is running in azure or not

Tags:

.net

azure

I have an asp.net mvc app that is built to run as standard web app in iis or in the cloud.

I need to be able to determine if the app is being hosted in azure(dev fabric or cloud) or if it is being run as standard web app under iis.

How can I tell if it is running in cloud?

like image 554
longday Avatar asked May 17 '09 04:05

longday


2 Answers

Think I found it:

Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.IsAvailable

Thanks

@Wheat: Thanks for such a quick response, makes stackoverflow.com a great resource.

like image 162
longday Avatar answered Oct 02 '22 09:10

longday


Could you use the StorageAccountInfo class?:

In your StorageAccountInfo object, the property "usePathStyleUris" is false when you are pointing to cloud storage and true when you are pointing to Development Storage locally.

like image 42
Mitch Wheat Avatar answered Oct 02 '22 08:10

Mitch Wheat