locked
sync from blob to container and run the sample code without using command prompt. RRS feed

  • Question

  • Hi,
    i have downloaded the sample from http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sync&ReleaseId=3638 for syn blob with local file.

    But i want to ask you that when i run it from the command line prompt then it is running perfectly but when i debug it in visual studio by doing the following changes in the code then its also doing uploading very well but gives exception of "Absolute Path Not Supported" when it starts downloading.

    // if (!ParseArgs(args))
      //              {
        //                PrintUsage();
          //              Environment.Exit(-1);
            //        }
                   
              //      if (!Directory.Exists(_localPathName))
                //    {
                  //      Console.WriteLine("Please ensure that the local target directory exists.");
                    //    Environment.Exit(-1);
                   // }
                   
                    
                    _localPathName = @"D:\Pictures";
                    _containerName = "photogallery";

    I hard code local path and container name so we dont need to run it from command prompt. I just debug it but it gives the exception of
    "Absolute Path Not Supported". please can any one tell me that why this is happening?
    or any suggestions that how can i run it correctly without using command prompt?

    And  i have one more question that when i run it from command prompt it is correctly synchronize from blob to local because i have changed the direction of synchronization in code like "orchestrator.Direction = SyncDirectionOrder.Download;" but it is not deleted any extra file which is placed on local file system.


    Can any one tell me that how it will delete the file from local file system after synchronize from blob to local file
    Friday, January 29, 2010 5:47 AM

Answers

  • Hi Zafar

    The reason why you see the exception when running in Debugger mode (Ctrl+F5), and not when running Without Debugging (F5) is because the AzureBlobSync apps catches the exception inside of the static void Main method.

    You can see this in the file AzureSyncConsoleApp.cs, in the three lines of code inside of the main section.  There the exception is caught, and its output printed.

    When you run in the Debugger, by default, Visual Studio will stop at every exception thrown, handled or not. 

    To find out where the exception is really comming from, you can modify the last three lines of code in the main method to read:

    catch (Exception e)
    {
          Console.WriteLine(e);
          Console.WriteLine(e.StackTrace); // add this
    }

    and print out for us the information from the stack trace, to better understand where the Absolute Path Not Supported exception is comming from.

    Regards,

    Maria del Mar Alvarez Rohena Microsoft Sync Framework
    Wednesday, February 10, 2010 5:30 PM
  • 1. For the exception "Absolute Path Not Supported" issue, please see my posting at http://social.msdn.microsoft.com/Forums/en-US/syncdevdiscussions/thread/40f93966-edd4-4b94-9033-c2940154d2a3.  It is a check box settings at "Thrown" category of the Exceptions dialog when can be launched from menu Debug->Exceptions in the Visual Studio IDE.

    2. Regarding the second question - deleting the extra files, what was your exact scenario?  In general, when sync direction is Download (from Azure blob to the local file folder), then only file change on the Azure blob side will be sent to the local file folder.  However sync won't touch on any other local files you created in this folder because they are not in the sync community.

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, February 10, 2010 6:13 PM
    Answerer

All replies

  •  

     

    Exception ("Absolute Path Not Supported") is raised from property [public string AbsoluteSourceFilePath] of file [AzureBlobSync\FileRetriever.cs].  The [AbsoluteSourceFilePath] property was not used in the sample code.  Did you use it?

    Anyway, I have downloaded this sample code and hard code both [_localPathName ] and [_containerName ] and I am not seeing any issue even from debugging in the VS environment.

    Q2: What was the scenario "it is not deleted any extra file which is placed on local file system"?  How did your NTFS get the extra file?  Sync from Blob storage or created locally?

    Thanks.


    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, January 29, 2010 3:23 PM
    Answerer
  • Hi
    i when i debug it using F5 then Exception ( "Absolute Path Not Supported" ) come from the property. and when i run it using ctrl+F5 then no exception come.

    but my major problem is that when i sync it from Blob to local e.g in my container blob i have
    a.jpg, b.jpg, and c.jpg and on my local C://Pictures i have a.jpg and xyz.jpg. After sync from blob to local i have a.jpg, b.jpg, and c.jpg and also xyz.jpg but it is not syn because xyz.jpg is not on blob so xyz.jpg must be deleted from the local.

    Regards,
    Zafar.
    Monday, February 1, 2010 5:13 AM
  • Did these extra files on the local system come from the blob store? If they did and they are now deleted on the blob store but not deleted locally?
    Then there could be an issue we can try to look at.

    However if these files were created locally and the blobl store never had these files, then these files will not go away by doing sync. The blob store never had any idea about these files and it cannot send a delete to the local store. You will have to delete them manually.
    This posting is provided AS IS with no warranties, and confers no rights
    Monday, February 1, 2010 5:15 AM
  • Yah you are right that i have created these files locally and the blob store never had these files. ok thanx.

    I want to ask you one more question that once i do synchronize and it prints message "synchronization complete". Then i manually delete file from local and again run your code for sync then it again prints message "synchronization complete" without doing sync. and when i delete the metadata and raplica files from local then it do synchronization. Why it does not do sync automatically without deleting metadata and raplica files?

    Regards,
    Zafar

    Monday, February 1, 2010 5:37 AM
  • Zafar, are you saying that the local delete does not get propagated without deleting the metadata and the replica files?
    That seems like a bug to me. Can you confirm this and we can take a look at it.
    This posting is provided AS IS with no warranties, and confers no rights
    Monday, February 1, 2010 5:59 AM
  • Hi

    Yes after doing first time sync complete when i again trying to sync it by deleting the file from local then it prints message  "synchronization complete" without doing any sync. But when i delete metadata and replica files from local then it doing sync otherwise it simply shows message synchronization complete.

    And i also want to inform you that when i delete file from blob and when i do sync again then it actually do sync without deleting metadata and replica files

    plz resolve this bug i am waiting for your help.

    regards,
    zafar
    Monday, February 1, 2010 6:11 AM
  • Hi you have not answered my full question. when i debug it using F5 then Exception ( "Absolute Path Not Supported" ) come from the property. and when i run it using ctrl+F5 then no exception come.

    I have also convert this code in web based application i just make three classes same as it is in sample code AzureBlobSyncProvider.cs, AzureBlobStore.cs, FileRetriever.cs and from AzureSyncConsoleApp.cs i have copy the code and paste against the load event of the page but i am getting same exception.

    Plz help me .

    Regards,
    zafar
    Tuesday, February 2, 2010 5:27 AM
  • Zafar the problem is in your _localPathName variable.  When entering local paths you for every '\' you should write and extra '\'.  Your code should work make the following change

    from:
           _localPathName=  @"C:\assets";

    to:
           _localPathName=  @"C:\\assets";

    Maria del Mar Alvarez Rohena Microsoft Sync Framework
    Tuesday, February 9, 2010 4:41 PM
  • Hi thanx
     But if this exception come due to incorrect local path then why it is not come when i run it using ctrl+F5. When i run it using ctrl+F5 no exception come and successfully sync completed.

    Regards,
    zafar.
    Wednesday, February 10, 2010 4:59 AM
  • Hi Zafar

    The reason why you see the exception when running in Debugger mode (Ctrl+F5), and not when running Without Debugging (F5) is because the AzureBlobSync apps catches the exception inside of the static void Main method.

    You can see this in the file AzureSyncConsoleApp.cs, in the three lines of code inside of the main section.  There the exception is caught, and its output printed.

    When you run in the Debugger, by default, Visual Studio will stop at every exception thrown, handled or not. 

    To find out where the exception is really comming from, you can modify the last three lines of code in the main method to read:

    catch (Exception e)
    {
          Console.WriteLine(e);
          Console.WriteLine(e.StackTrace); // add this
    }

    and print out for us the information from the stack trace, to better understand where the Absolute Path Not Supported exception is comming from.

    Regards,

    Maria del Mar Alvarez Rohena Microsoft Sync Framework
    Wednesday, February 10, 2010 5:30 PM
  • 1. For the exception "Absolute Path Not Supported" issue, please see my posting at http://social.msdn.microsoft.com/Forums/en-US/syncdevdiscussions/thread/40f93966-edd4-4b94-9033-c2940154d2a3.  It is a check box settings at "Thrown" category of the Exceptions dialog when can be launched from menu Debug->Exceptions in the Visual Studio IDE.

    2. Regarding the second question - deleting the extra files, what was your exact scenario?  In general, when sync direction is Download (from Azure blob to the local file folder), then only file change on the Azure blob side will be sent to the local file folder.  However sync won't touch on any other local files you created in this folder because they are not in the sync community.

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, February 10, 2010 6:13 PM
    Answerer