locked
How to change the WorkerLocalStorage Location RRS feed

  • Question

  • Hi,

    It's possible to change the WorkerLocalStorage location in the "Compute Emulator" ?

    Rigth now is going to c:\Users\#username#\AppData\Local\dftmp\Resources\GUID\directory\WokerLocalStorage\#myfolder#

    The problem here is the #myfolder# contains also a GUID in the internal folder names and make the complete path too long (more than 260 characters).

    So i'm trying to use run commands like this:

    "C:\long path to the .exe that is in the WorkerRole Package\file.exe" "c:\very long path of the file that is inside the WorkerLocalStorage\file.txt"

    The file.exe will complain because the path to file.txt is more than 260.

    If anyone has some idea how to change the  location of WorkerLocalStorage in "Compute Emulator" to be like "c:\place\GUID\directory\..." would be very nice.

    Thanks in advance

    Rui


    Rui Santos

    Thursday, December 6, 2012 8:26 AM

Answers

All replies

  • Hi,

    I don't think the folder path of a localstorage will be a big problem. Usually we get the storage by:

    LocalResource mystorage = RoleEnvironment.GetLocalResource("storagename");

    And get the path by: mystorage.RootPath

    So they can be controlled easily without typing any long file path or name. Storing path to a file cannot be a working way based on my opinion, because how can you set it in config file to locate it.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 7, 2012 2:53 AM
  • Hi Qin,

    Thanks for your reply, I don't know if you misunderstood me or I misunderstood your reply.

    I know how to get the path of WorkerLocalStorage, and I won't like to save it anywhere, what I would like is to configure the Cloud Emulator in my computer and define a short path to the WorkerLocalStorage.

    Lets make some math:

    1) The default location of the WorkerLocalStorage is: 

    c:\Users\#username#\AppData\Local\dftmp\Resources\GUID\directory\WokerLocalStorage\ (in my case, with my username I got  112 characters in the path)

    2) My worker role is downloading a Zip file, to the WorkerLocalStorage, and the zip file is being decompressed to there, which have this structure:

    FileName_GUID\report\Guid_ReportFile\Guid_ReportFile.txt (which in some cases I got 200 characters)  

    3) Now I have a program that is trying to read the file Guid_ReportFile.txt and try to access:c:\Users\#username#\AppData\Local\dftmp\Resources\GUID\directory\WokerLocalStorage\FileName_GUID\report\Guid_ReportFile\Guid_ReportFile.txt (which will be 112+200 =312 ) and the program will complain because cannot access path more than 260 characters

    I cannot change the program that is reading the file to be able to read files with more than 260 characters in the path, so I would like to change the path of the WorkerLocalStorage because the default location is consuming almost 50% of my allowed size.

    I want to prevent this kind of code in my application:

    #if DEBUG
      // path = path of the root decompressed folder in the   WorkerLocalStorage
      DirectoryInfo d = new DirectoryInfo(path);
      if (d.Exists)
      {
         DirectoryInfo newPath = new DirectoryInfo(@"c:\CloudStorage\" + d.Name);
         if (newPath.Exists)
         {
           Directory.Delete(@"c:\CloudStorage\" + d.Name, true);
         }
         Directory.Move(d.FullName, @"c:\CloudStorage\" + d.Name);
         path = @"c:\CloudStorage\" + d.Name + System.IO.Path.DirectorySeparatorChar;
      }
    #endif

    Please let me know if you see other way to do what I want.

    Thanks in advance

    Rui

    Friday, December 7, 2012 7:34 AM
  • Hi,

    If I understand right, you can set the custom path by setting environment variable:

    http://blogs.msdn.com/b/silverlining/archive/2011/08/31/ruby-and-windows-azure-local-storage.aspx

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, December 10, 2012 3:28 AM
  • Hi Qin,

    If I understood correctly what the blog is saying is how to change the environment variable, there is any environment variable to the LocalStorage?

    I don't think so, this seems not be the answer. (If you agree please remove the "Marked As Answer" to others may help too).

    Thanks in advance,

    Rui

    Thursday, December 13, 2012 5:51 AM
  • Hi,

    I find the solution:

    http://blogs.msdn.com/b/jnak/archive/2010/01/14/windows-azure-path-too-long.aspx

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 14, 2012 3:23 AM
  • Hi Qin,

    Now yes, thanks so much ;)

    Rui Santos

    Friday, December 14, 2012 4:44 AM
  • Hi,

    You are welcome. Sorry for the inconvenience. Hope your understanding.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 14, 2012 4:50 AM
  • Hi Qin,

    Today I was testing the solution and what I found is with Visual Studio 2012 if I define that environment variable everything stop working.

    Even the VS 2012 don't start and give a message saying "Exception in target evocation" something like that and I can't open the solutions.

    If I remove the Env Variable and restart the machine everything works fine ... :S

    So this Env Variable only works on VS 2010 ?

    Thanks

    Rui

    Tuesday, December 18, 2012 11:31 AM
  • Hi,

    It seems a permission issue of the project folder/directory as this thread said:

    http://social.msdn.microsoft.com/Forums/en-US/vstest/thread/5eab961e-7632-4948-a791-f7952ff9d4a8

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, December 19, 2012 2:39 AM