none
System.UnauthorizedAccessException because it can't access : "HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server Compact Edition\v3.5 RRS feed

  • Question

  • HI,

    My development machine synthronization working fine, but when i install application to server its raise following error

    System.UnauthorizedAccessException because it can't access :

    "HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server Compact Edition\v3.5

    According to my research i saw this explanation

    "set the ClientId property on the client provider (SqlCeClientSyncProvider) in your client application"

    How can set clientid? Is there any code?

    here is my code

       LocalDataCache1SyncAgent syncAgent = new LocalDataCache1SyncAgent();
                Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize();

    Friday, April 6, 2012 5:44 PM

All replies

  •  var localProvider = (ClientSyncProvider) syncAgent.LocalProvider;
     localProvider.ClientId = "<your value here, must be a guid>";

    Saturday, April 7, 2012 1:50 AM
    Moderator
  • I have done this way, is it correct

     // Call SyncAgent.Synchronize() to initiate the synchronization process.
                // Synchronization only updates the local database, not your project's data source.
                LocalDataCache1SyncAgent syncAgent = new LocalDataCache1SyncAgent();
                Microsoft.Synchronization.Data.SyncStatistics syncStats = syncAgent.Synchronize();
                var localProvider = (ClientSyncProvider)syncAgent.LocalProvider;
                localProvider.ClientId = Guid.Parse("53406795-968f-4205-904d-12f7388316eb");

    Sunday, April 8, 2012 3:11 AM
  • you should set the clientid before you call synchronize.
    Sunday, April 8, 2012 10:09 AM
    Moderator