Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
The call to BeginSession() in RelationalSyncProvider is not valid. A session is already in progress.

Unanswered The call to BeginSession() in RelationalSyncProvider is not valid. A session is already in progress.

  • Tuesday, January 08, 2013 5:40 PM
     
     

    I have two syncOrchestrator configured for same peers but for different scopes as shown below:

      SyncOrchestrator scopeA=new syncorchestrator();

      SyncOrchestrator scopeB=new syncorchestrator();

    two scopes don't share any common database table.

    When I initiate the two synchronize() on the two syncOrchestrator's in two different threads , I was getting following error message:

    The call to BeginSession() in RelationalSyncProvider is not valid. A session is already in progress.

    Cant we have two syncorchestrator on same peers running the synchronization?


    ess


    • Edited by saitrips Tuesday, January 08, 2013 5:55 PM
    •  

All Replies

  • Wednesday, January 09, 2013 1:00 AM
    Moderator
     
     
    are you assigning different sync providers for each one?
  • Wednesday, January 09, 2013 1:15 AM
     
     

    yes.

    This is N-Tier sync. I hosted my remote provider on wcf(remote machine) and made the service behaviour available to multiple requests by having configuration as

    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession,ConcurrencyMode=ConcurrencyMode.Multiple)]

    Now window service on client machine have two threads running.

    Each thread will have separate syncorchestrator object, and proxy to wcf service to call methods (beginsession,getknowledge...............endsession) on remoteprovider. 

    this is how i designed my app.

    is there anything wrong with design. plz let me know if u need additional info.


    ess

  • Wednesday, January 09, 2013 2:40 PM
     
     

    plz let me know if u need any additional info. sync framework methods are not thread safe?


    ess

  • Wednesday, January 09, 2013 3:16 PM
    Moderator
     
     
    afaik, they're not.
  • Wednesday, January 09, 2013 3:32 PM
     
     
    Would you have any idea of how we can handle sync of two different scopes on same peers at same time(by putting in two different threads).

    ess

  • Thursday, January 10, 2013 2:44 AM
    Moderator
     
     

    can you try enabling sync framework tracing so we can figure out which provider it's failing?

    or try changing you concurrency mode in wcf

  • Friday, January 11, 2013 1:05 AM
     
     

    in my wcf service, concurrency mode is multiple.

    Yesterday I tried few things and below are my findings:

    If I have to two client windows service for each scope accessing single wcf service hosted - sync is working.

    If I run two threads in one window service, its throwing error.


    ess

  • Friday, January 11, 2013 2:05 AM
    Moderator
     
     
    I suggest you focus on how you're instantiating the local provider in your app and how you're attaching it to the corresponding syncorchestrator.
  • Wednesday, January 16, 2013 5:51 PM
     
     

    Hi JuneT,

    Its started working. I am using wshttpbinding. the problems is with in-efficient handling of sessions.

    I remember it started working after making few changes related to sessions (don't remember what exactly) in wcf service web.config file

    following is one among them:

     <reliableSession enabled = "true"/>


    ess