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

  • Question

  • 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 8, 2013 5:55 PM
    Tuesday, January 8, 2013 5:40 PM

All replies

  • are you assigning different sync providers for each one?
    Wednesday, January 9, 2013 1:00 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 9, 2013 1:15 AM
  • plz let me know if u need any additional info. sync framework methods are not thread safe?


    ess

    Wednesday, January 9, 2013 2:40 PM
  • afaik, they're not.
    • Edited by JuneT Wednesday, January 9, 2013 3:16 PM
    Wednesday, January 9, 2013 3:16 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

    Wednesday, January 9, 2013 3:32 PM
  • 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

    Thursday, January 10, 2013 2:44 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 1:05 AM
  • 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.
    Friday, January 11, 2013 2:05 AM
  • 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

    Wednesday, January 16, 2013 5:51 PM