locked
SQL Azure Syncronization Exception RRS feed

  • Question

  • I get the following exception when I try to SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();

    Microsoft.Synchronization.Data.SqlServer.SqlProviderFactory.ReadCo nfiguration(String scopeName) at Microsoft.Synchronization.Data.SqlServer.SqlProviderFactory.GetConfigurati on(String scopeName) at Microsoft.Synchronization.Data.SqlServer.SqlSyncProvider.Configure() at Microsoft.Synchronization.Data.SqlServer.SqlSyncProvider.BeginSession(Sync ProviderPosition position, SyncSessionContext syncSessionContext) at Microsoft.Synchronization.KnowledgeProviderProxy.BeginSession(SYNC_PROVIDE R_ROLE providerRole, ISyncSessionState pSessionState) at Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTI ON_POLICY resolutionPolicy, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics) at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(Syn cIdFormatGroup sourceIdFormats, SyncIdFormatGroup destinationIdFormats, Knowledg eSyncProviderConfiguration destinationConfiguration, SyncCallbacks DestinationCa llbacks, ISyncProvider sourceProxy, ISyncProvider destinationProxy, ChangeDataAd apter callbackChangeDataAdapter, SyncDataConverter conflictDataConverter, Int32& changesApplied, Int32& changesFailed) at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync( SyncDataConverter sourceConverter, SyncDataConverter destinationConverter, SyncP rovider sourceProvider, SyncProvider destinationProvider, Int32& changesApplied, Int32& changesFailed) at Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize() at Microsoft.Synchronization.SyncOrchestrator.Synchronize()


    Any help would be much appreciated. 
    Sunday, February 7, 2010 7:21 PM

Answers

  • Would you mind logging to both SQL server and SQL Azure database and do SELECT * from [scope_info] and select * from [scope_configure].

    The scope information should appear on both databases.  Otherwise you may encounter a provisioning issue.

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, February 10, 2010 8:32 AM
    Answerer
  • Hello Rezaul,

    Please do the queries L Zhou suggested on both databases and see if "SyncXXXX" appears.

    Also, try another scope name in case this is caused by scope name containing some special character.

    If the above still does not work, please tell us what the scope name string is, and we will see if we can repro the behavior. 

    Thanks,

    Patrick
    • Proposed as answer by Yunwen Bai Tuesday, February 16, 2010 9:29 AM
    • Marked as answer by Yunwen Bai Tuesday, February 16, 2010 9:29 AM
    Wednesday, February 10, 2010 10:21 PM

All replies

  • More info : 

    Running on a 64bit machine.
    Windows 7
    MS SQL  Server R2
    Microsoft Sync Framework 2.0 (32 bit version) x86
    Microsoft Sync Framework Power Pack for SQL Azure Novermber CTP (32 bit version) x86

    I can run the following from the command line and it works fine

    "C:\Program Files\Microsoft Sync Framework\Power Pack For SQL Azure November CTP\SyncLocalSqlAzureDatabase.exe" -localServer localhost -localDb XXXXX -SqlAzureDb XXXX -scope Sync_XXXX ca21prq784.database.windows.net -SqlAzureUser XXXX -SqlAzurePassword XXXXX -ConflictResolutionPolicy LocalServerWins

    My code which gives the exceptions is as follows : 

                    SyncOrchestrator syncOrchestrator = new SyncOrchestrator();
                    SqlSyncProvider localSqlSyncProvider = new SqlSyncProvider("SyncDB", 
                                                                                        new SqlConnection(localConnectionString));
                    SqlAzureSyncProvider azureSqlSyncProvider = new SqlAzureSyncProvider("SyncDB", 
                                                                                         azureConnectionString);

                    syncOrchestrator.LocalProvider = localSqlSyncProvider;
                    syncOrchestrator.RemoteProvider = azureSqlSyncProvider;
                    
                    syncOrchestrator.Direction = SyncDirectionOrder.Upload;

                    try
                    {
                        SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();
    ;
                    }
                    catch (Exception e) {
                        Console.WriteLine( e.StackTrace);
                  
                    }

    Any help would be much appreciated. 


    Sunday, February 7, 2010 7:30 PM
  • Hello Rezaul,

    I would be more than happy to help you.

    What is the exception message and type that you get? Can you print out e.tostring?

    Thanks,

    Patrick
    Monday, February 8, 2010 12:47 AM
  • Hello Patric,

    Here is print from e.tostring :

    Microsoft.Synchronization.Data.DbSyncException: Cannot find a valid scope with t
    he name 'SyncDB' in table '[scope_info]'. Ensure that
     this scope exists and that it has a corresponding valid configuration in the co
    nfiguration table '[scope_config]'.
       at Microsoft.Synchronization.Data.SqlServer.SqlProviderFactory.ReadConfigurat
    ion(String scopeName)
       at Microsoft.Synchronization.Data.SqlServer.SqlProviderFactory.GetConfigurati
    on(String scopeName)
       at Microsoft.Synchronization.Data.SqlServer.SqlSyncProvider.Configure()
       at Microsoft.Synchronization.Data.SqlServer.SqlSyncProvider.BeginSession(Sync
    ProviderPosition position, SyncSessionContext syncSessionContext)
       at Microsoft.Synchronization.KnowledgeProviderProxy.BeginSession(SYNC_PROVIDE
    R_ROLE providerRole, ISyncSessionState pSessionState)
       at Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTI
    ON_POLICY resolutionPolicy, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(Syn
    cIdFormatGroup sourceIdFormats, SyncIdFormatGroup destinationIdFormats, Knowledg
    eSyncProviderConfiguration destinationConfiguration, SyncCallbacks DestinationCa
    llbacks, ISyncProvider sourceProxy, ISyncProvider destinationProxy, ChangeDataAd
    apter callbackChangeDataAdapter, SyncDataConverter conflictDataConverter, Int32&
     changesApplied, Int32& changesFailed)
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync(
    SyncDataConverter sourceConverter, SyncDataConverter destinationConverter, SyncP
    rovider sourceProvider, SyncProvider destinationProvider, Int32& changesApplied,
     Int32& changesFailed)
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize()
       at Microsoft.Synchronization.SyncOrchestrator.Synchronize()
       at DynamicsNAVDataSync.Program.Main(String[] args)

    Thank you in advance.
    Tuesday, February 9, 2010 11:33 AM
  • Hi -

    From your command line below are you sure that the scopeName below is the exact same one that you pass to the constructors of the two providers in your code ( contructors of SqlSyncProvider and SqlAzureSyncProvider)?


    C:\Program Files\Microsoft Sync Framework\Power Pack For SQL Azure November CTP\SyncLocalSqlAzureDatabase.exe" -localServer localhost -localDb XXXXX -SqlAzureDb XXXX -scope Sync_XXXX ca21prq784.database.windows.net -SqlAzureUser XXXX -SqlAzurePassword XXXXX -ConflictResolutionPolicy LocalServerWins


    Thanks
    Deepa
    Deepa ( Microsoft Sync Framework)
    Tuesday, February 9, 2010 8:27 PM
    Answerer
  • Hello Deepa,

    Yes, I am sure about the scope name I am passing to the constructors. I replaced them with XXX in the sample for the cmd I pasted here, to avoid using the original product name which was part of the scope name :). Sorry for causing the confusion. The same scope name that is passed in the cmd after the -scope flag is passed on to the two constructors as a string. 

    Any other clue what might be wrong ? 

    Regards
    /Reza
    Tuesday, February 9, 2010 10:39 PM
  • Would you mind logging to both SQL server and SQL Azure database and do SELECT * from [scope_info] and select * from [scope_configure].

    The scope information should appear on both databases.  Otherwise you may encounter a provisioning issue.

    Thanks.
    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, February 10, 2010 8:32 AM
    Answerer
  • Hello Rezaul,

    Please do the queries L Zhou suggested on both databases and see if "SyncXXXX" appears.

    Also, try another scope name in case this is caused by scope name containing some special character.

    If the above still does not work, please tell us what the scope name string is, and we will see if we can repro the behavior. 

    Thanks,

    Patrick
    • Proposed as answer by Yunwen Bai Tuesday, February 16, 2010 9:29 AM
    • Marked as answer by Yunwen Bai Tuesday, February 16, 2010 9:29 AM
    Wednesday, February 10, 2010 10:21 PM
  • Thank you. I found out that the scope name was wrong which I was passing. Found out the right scope name as suggested by quering "SELECT * from [scope_info]"

    Thank you for the help. Appriciated.
    Sunday, February 14, 2010 5:37 PM