locked
SyncServicesForDevicesSample RRS feed

  • Question

  •  

    Hi,

    I'm trying the SyncServicesForDevicesSample sample.

    I am using VS 2008.

    I am getting the following error while synchronizing the desktop db with the server db:

    Exception has been thrown by  the target of an invocation

    It occurs at the line:

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

     

    Any idea???

    Thanks in advance

     

    • Moved by Hengzhe Li Friday, April 22, 2011 5:22 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, June 4, 2008 7:30 AM

Answers

All replies

  •  

    what device are you running on ? can you check if the syncserivce cab and the SQLCE cab are deployed successfuly to the device?

     

    thanks

    Yunwen

     

    Wednesday, June 4, 2008 10:18 PM
    Moderator
  • Hi,

     

    Thanks for the quick response, I really appreciate it.

    Plz crrect me whenever I did something wrong.
    Here is What I did step by step:


    1-I've open the GBASyncServicesForDevices.sln in VS 2008.


    2-I've run the CreateGBAppraiseDB.sql successfully.
    In my Sql Server 2005 , I have server authentication set to: SQL Server and Windows Authentication mode.
    I didn't change the connection string. GBAServerSyncProvider--> Properties --> Settings --> Test connection was succesful.


    3- GBAServerSyncProvider built successfully.
       I didnt't do any changes to the Settings.Designer.cs because I am using the same connection string.


    4-Add a new ASP.Net Web Service to the solution.
       Replacing the Service.cs content by the provided one.
       I had to add to this web service the following libraries as references:
       GBAServerSyncProvider.dll
       Microsoft.Synchronization.dll
       Microsoft.Synchronization.Data.dll
       Microsoft.Synchronization.Data.Server.dll
       Web site launched in IE successfully.


    5- For the GBADesktopClient:
       under Settings.Designer.cs :    
       [global:Tongue Tiedystem.Configuration.DefaultSettingValueAttribute("http://localhost/GBAWebService/Service.asmx")]
           under Settings.settings: 
           <Setting Name="SyncWebServiceURL" Type="(Web Service URL)" Scope="Application">
              <Value Profile="(Default)">http://localhost/GBAWebService/Service.asmx</Value>
           </Setting>
            under app.config:
            <setting name="SyncWebServiceURL" serializeAs="String">
                <value>http://localhost/GBAWebService/Service.asmx</value>
           </setting>
       
    6-For the GBADeviceClient: 
    under Settings.cs:   private string _webServiceURL = "http://localhost/GBAWebService/Service.asmx";
     

    7-Before trying to run it on a device, I've set the GBADesktopClient as a startup project.

    Initially, It is loading the data from the server.

    However, wneh I click on the Synchronization button, I am getting the following error:

    Exception has been thrown by  the target of an invocation

    that occurs at the line:

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


    8-When I try to update the service reference for the GBADesktopClient, it failed:


    There was an error downloading http://localhost:8080/GBACacheSyncService/mex.

    Unable to connect to the remote server

    ..........

    No connection could be made because the target machine actively refused it 127.0.0.1:8080

     

     

    I beleive that if I could solve this problem, it should work fine on the device.

    On my device, I have : Sync Service for ADO.NET 1.0 and SQLServerCompact 3.5 installed.

    N.B.: I have VS 2005 and VS 2008 pro installed on my machine. Does it affect anything?

     

     

    Thanks for you help,
    Faten


          
        
      
      
      

     

     

     


     

    Thursday, June 5, 2008 2:31 AM
  • Hi

    I am getting the same error on the GBADesktopClient and on the GBADeviceClient:

     

    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.EntryPointNotFoundException: Entry point was not found.
       at System.Collections.Generic.ICollection`1.get_Count()
       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GenerateOrderedGroupMetadata(SyncGroupMetadata groupMetadata)
       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.ResetProivderState(SyncGroupMetadata groupMetadata, DataSet dataSet)
       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
       at Service.GetChanges(SyncGroupMetadata groupMetaData, SyncSession syncSession)
       --- End of inner exception stack trace ---
       at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at GBADesktopClient.ConfiguredSyncWebService.GetChanges(SyncGroupMetadata groupMetaData, SyncSession syncSession) in C:\CTP1SampleGBA\package_bits\SyncServicesForDevicesSample\GBADesktopClient\ConfiguredSyncService.cs:line 144
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
       at Microsoft.Synchronization.SyncAgent.DownloadChanges(SyncGroupMetadata groupMetadata)
       at Microsoft.Synchronization.SyncAgent.DataSynchronize()
       at Microsoft.Synchronization.SyncAgent.Synchronize()
       at GBADesktopClient.Form1.syncToolStripButton_Click(Object sender, EventArgs e) in C:\CTP1SampleGBA\package_bits\SyncServicesForDevicesSample\GBADesktopClient\Form1.cs:line 44

     

    Thanks

     

    Thursday, June 5, 2008 10:58 PM
  • on devices, the url should be specified as http://<your host machine name>\webserviceNmae/service.asmx. the device cannot recongnize http://localhost as desktop does. and this might be the casue.

     

    Could you give a quick try ?

     

    thanks

    Yunwen

    Thursday, June 5, 2008 11:25 PM
    Moderator
  • Hi,

     

    Thanks for your help.

    I can access the webservice from the device.

    By replacing the localhost by the IP address, I got the following error now on the Device:

     

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> There was an error generating the XML document. ---> Unable to cast object of type 'Microsoft.Synchronization.Data.SyncSchema' to type 'Microsoft.Synchronization.Data.SyncSchema'.
       at System.Web.Services.Protocols.SoapHttpClientProtocol.doInvoke(String methodName, Object[] parameters, WebClientAsyncResult asyncResult)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at GBADeviceClient.Sync.ConfiguredSyncWebServiceProxy.GetSchema(String[] tableNames, SyncSession syncSession)
       at GBADeviceClient.Sync.ServerSyncProviderProxy.GetSchema(Collection`1 tableNames, SyncSession syncSession)
       at Microsoft.Synchronization.SyncAgent.InitClientSchema()
       at Microsoft.Synchronization.SyncAgent.Synchronize()
       at GBADeviceClient.Program.Main()

     

    And on the desktop, still the old error message.

     

    Any suggestions?

    Thanks

     

    Friday, June 6, 2008 1:27 AM
  • Now I think we are getting closer.

     

    can you check on the IIS server box ( where hosts your web service ), what sync service version was installed and which was loaded ?

     

    can you debug your web services service code to see what is the cause of exception ?

     

     

    thanks

    Yunwen

     

    Friday, June 6, 2008 11:37 PM
    Moderator
  • Hi,

     

    I can debug my web service without problems.

     

    I noticed that after installing Microsoft Synchronization Services,

    my web service is referencing to:

    Microsoft.Synchronization.Data.dll

    under

    C:\Program Files\Microsoft Synchronization Services\ADO.NET\v1.0\Devices

     

    but the thing is that I don't have Microsoft.Synchronization.Data.Server.dll under this directory:

    C:\Program Files\Microsoft Synchronization Services\ADO.NET\v1.0\Devices

     

    However I have Microsoft.Synchronization.Data.SqlServerCe.dll

    under:

    C:\Program Files\Microsoft Synchronization Services\ADO.NET\v1.0\Devices

     

    That's why my web service is referencing to :

     Microsoft.Synchronization.Data.Server.dll

    under

    C:\Program Files\Microsoft SDKs\Microsoft Sync Framework\v1.0\Runtime\x86

     

    Do you think it could be the reason?

    Why don't I have Microsoft.Synchronization.Data.Server.dll under this directory:

    C:\Program Files\Microsoft Synchronization Services\ADO.NET\v1.0\Devices

    ??

     

    Thanks,

     

     

     

    Monday, June 9, 2008 11:37 PM
  • Hi

    Just for more details:

    My web service is referencing to:

    Microsoft.Synchronization.dll

    under C:\Program Files\Microsoft SDKs\Microsoft Sync Framework\v1.0\Runtime\x86

     

    My GBAServerSyncProvider is referencing to:

    Microsoft.Synchronization.Data.dll

    under C:\Program Files\Microsoft Synchronization Services\ADO.NET\v1.0\Devices

    Microsoft.Synchronization.Data.SqlServerCe.dll

    under C:\Program Files\Microsoft Synchronization Services\ADO.NET\v1.0\Devices

     

    My GBADeviceClient is referencing to:

    Microsoft.Synchronization.dll

    under C:\Program Files\Microsoft SDKs\Microsoft Sync Framework\v1.0\Runtime\x86

    Microsoft.Synchronization.Data.dll

    under C:\Program Files\Microsoft Sync Framework\v1.0\Runtime\ADO.NET\V2.0\x86

    Microsoft.Synchronization.Data.Server.dll

    under C:\Program Files\Microsoft Sync Framework\v1.0\Runtime\ADO.NET\V2.0\x86

     

    Thanks,

     

     

     

    Tuesday, June 10, 2008 3:25 AM
  • Hi

    It worked now.

    I created a new web service outside the solution, get it working fine.

    Then adding this existing web service to my solution.

    I'm not sure if I wasn't creating the  web service  properly b4.

    Anyway, thanks a lot for your help and for your assistance.

     

    Thanks,

     

    Tuesday, June 10, 2008 3:42 AM
  • Hi Dear,

    i have problems with this sample!

     

    the sample in general line, does good work but with smart device not!!!!!!

     

    the connection is rejected with an invocation of a method of web service (GetSchema in WebService)

     

     

    besides the problem of conflict versions of dll by SP on the current version SQL server compact y ADO.net Sync

    whats happens?

    the products used: Visual Studio 2008 SP1 Spanish SQL server Express 2008, Windows XP SP3
    Emulator Windows Mobiles 5, etc

     
     
    Greetings
    Jorge Pedraza
    Barquisimeto,Venezuela
    Monday, November 17, 2008 4:17 PM
  • To whoever at Microsoft is responsible for this sample - there is a bug in it that should be fixed. Both table adapters reference columns called LastEditDate and CreationDate, but the names of the columns in the SDF are ModifiedDate and CreatedDate.
    Monday, March 16, 2009 3:36 PM