Handling Error ERROR_AZURE_DRIVE_DEV_PATH_NOT_SET when mounting a cloud drive


If you have the same code running in ASP.NET (within web role you may not hit the problem) however if you try to do this outside role code or from a standalone app you have much more chances to hit this error.

 

Couple of months back, I have written a sample on how to mount a cloud drive using stand along app as below:

http://mountvhdazurevm.codeplex.com/

 

Today when I used my own sample I got error as “ERROR_AZURE_DRIVE_DEV_PATH_NOT_SET” so I was kind of surprised.. but I also had a chance to dig further which I like most..

 

With SDK 1.5 based application, I verify that RoleEnvironment was somehow not available, even the code was running inside a VM which already have Web Role running fine.

 

I did spend some time to understand why RoleEnvironment is not available and loop through the following function until it is try and within few seconds I could get my cloud drive mounted…

 

if (RoleEnvironment.IsAvailable)

{

  // Code will only work if Windows Azure role environment is ready

}

 

Not sure why (still looking for that) however you if you want to mount a cloud drive do the following to solve such errors:

  1. Before calling any Cloud drive related code, be sure to have RoleEnvironment.IsAvailable return as true
  2. If #1 is not available then loop through the code because cloud drive specific code will work only when Azure runtime environment is ready

 

 

Comments (1)

  1. Anuarg says:

    Please post a ServiceDefination.csdef file and also tell where to put in project.

Skip to main content