none
WebSharingAppDemo-CEProviderEndToEnd gives error during call to CheckIfProviderNeedsSchema for the CeSyncProviderProxy and it's before any files have been batched across so the server has no sdf file to look at. What am I doing wrong here? RRS feed

  • Question

  • I'm building an application based on the WebSharingAppDemo-CEProviderEndToEnd. When I deploy the server portion on a server, the code gives the error "The path is not valid. Check the directory for the database." during the call to NeedsScope() in the CeWebSyncService.cs file.

    Obviously the server can't access the client's sdf but what is supposed to happen to make this work? The app uses batching to send the data and the batches have to be marshalled across to the temp directory but how should the peerProivider connect to this batched data?

     public bool NeedsScope()
        {
          Log("NeedsSchema: {0}", this.peerProvider.Connection.ConnectionString);
          SqlCeSyncScopeProvisioning prov = new SqlCeSyncScopeProvisioning();

          return !prov.ScopeExists(this.peerProvider.ScopeName, (SqlCeConnection)this.peerProvider.Connection);
        }
    • Edited by don.kirby Wednesday, March 10, 2010 2:48 PM
    Monday, March 8, 2010 2:11 PM

Answers

  • I noticed that the sample was making use of a proxy to speak w/ the CE file but a provider (not a proxy) to speak w/ the sql server.

     

    I switched it so there is a proxy to reach the SQL server and a provider to access the CE file.

     

    That seems to work for me.

     

    stats = synchronizationHelper.SynchronizeProviders(srcProvider, destinationProxy);

     

    vs.

     

    SyncOperationStatistics stats = syncHelper.SynchronizeProviders(srcProxy, destinationProvider);

    • Marked as answer by don.kirby Friday, March 19, 2010 1:21 PM
    Friday, March 19, 2010 1:20 PM

All replies

  • Hi don.kirby,

    Check the peerProvider.Connection.ConnectionString property and make sure that the file exists. This must be the reason why you are getting the exception.

    In remote scenario, batched files should be copied to destination directory and destination's BatchingDirectory value should be set to that path.

    Hope this helps,

    Patrick
    Monday, March 8, 2010 9:32 PM
  • The error comes during the CheckIfProviderNeedsSchema for the CeSyncProviderProxy and it's before any files have been batched across so the server has no sdf file to look at. What am I doing wrong here?
    Tuesday, March 9, 2010 3:23 AM
  • hi don,

    Did you choose SQL Server as the Source Provider and a CE database as the Destination Provider Proxy when you click on the Synchronize button?
    Wednesday, March 10, 2010 4:01 PM
    Moderator
  • Thanks for you reply June.
    Yes that is the order. SQL Server as the Source Provider and a CE database as the Destination Provider Proxy.

    I also tested the other way around and ultimately get the same result but at a later step in the process.
    Wednesday, March 10, 2010 4:51 PM
  • i dont think the sample was meant to be run on separate machines.

    you get the error if you specify CE as the remote provider because the SynchronizeProviders constructor makes a call to NeedsScope on the remote CE provider proxy. This fires the NeedsScope on your WCF service on the server side which is a separate machine. Since you created the CE database on the client application, obviously, this would fail.

    I'm surprised though if you're getting exactly the same error on the same code when you do the sync where CE is the local provider and SQL is the remote provider.

    Wednesday, March 10, 2010 5:35 PM
    Moderator
  • So How do I change the sample  so it can be run on separate machines? That's the whole point of WCF right?
    Wednesday, March 10, 2010 6:24 PM
  • you can change the sample so that if the CE database is on the remote side, you create the CE Db on the remote side.

    • Marked as answer by Kyle LeckieEditor Thursday, March 18, 2010 4:01 PM
    • Unmarked as answer by don.kirby Thursday, March 18, 2010 7:00 PM
    Thursday, March 11, 2010 1:16 AM
    Moderator
  • I noticed that the sample was making use of a proxy to speak w/ the CE file but a provider (not a proxy) to speak w/ the sql server.

     

    I switched it so there is a proxy to reach the SQL server and a provider to access the CE file.

     

    That seems to work for me.

     

    stats = synchronizationHelper.SynchronizeProviders(srcProvider, destinationProxy);

     

    vs.

     

    SyncOperationStatistics stats = syncHelper.SynchronizeProviders(srcProxy, destinationProvider);

    • Marked as answer by don.kirby Friday, March 19, 2010 1:21 PM
    Friday, March 19, 2010 1:20 PM