correct application root in Azure DevFabric and the Cloud

by Euo 14. January 2010 08:50

In Azure DevFabric when you used: Environment.GetEnvironmentVariable("RoleRoot") you'll get 'AppRoot' as your Role root.It is suffixed to what should be the root in Azure Cloud. For example, in your devfabric your application will reside in 

"C:\Source\MyCloudApp\bin\Debug\MyCloudApp.csx\roles\MyCloudAppWorker\approot\<your binaries goes here>"

 but when you deployed your application in the Cloud it will reside in the root directory like: "E:\<your binaries goes here>" or something.

 I can't find and I don't know how to distinguished when my application is running in DevFabric or Cloud so I use application settings to easily correct/append the root path. 

 In my config I have:

      <!--when in DevFabric use - 'AppRoot'; use blank '' if in Azure-->
      <Setting name="ApplicationRoot" value="AppRoot" />

then from my code I have:

            string root = RoleEnvironment.GetConfigurationSettingValue("ApplicationRoot");

            AppRoot = Path.Combine(Environment.GetEnvironmentVariable("RoleRoot"), root);

 

Tags:

Cloud Computing | Development

About the author

Something about the author

Month List

Page List