locked
ADO.NET Sync Services: Mobile Device To Webservice RRS feed

  • Question

  • Hi,

    i am try to run a simple Client-Server Example which uses the ADO.NET Sync Services on my Mobile Device.

    I implemented an ASP-Webservice on the Server Side which  can access SQL-Server DB (Northwind in my case...)

    and a smart Device Project on the Clientside with a local cached DB.

    ##################################################################################################

    when i call the Synchronize() Method on my Client i get the following Exceptions:

    Der Thread 0xb6e432f6 hat mit Code 0 (0x0) geendet.
    Eine Ausnahme (erste Chance) des Typs "System.UriFormatException" ist in System.dll aufgetreten.
    Eine Ausnahme (erste Chance) des Typs "System.Net.Sockets.SocketException" ist in System.dll aufgetreten.
    Eine Ausnahme (erste Chance) des Typs "System.Net.Sockets.SocketException" ist in System.dll aufgetreten.
    Eine Ausnahme (erste Chance) des Typs "System.Net.Sockets.SocketException" ist in System.dll aufgetreten.
    Der Thread 0x56247222 hat mit Code 0 (0x0) geendet.
    Eine Ausnahme (erste Chance) des Typs "System.Net.WebException" ist in System.dll aufgetreten.
    Eine Ausnahme (erste Chance) des Typs "System.Net.WebException" ist in System.Web.Services.dll aufgetreten.
    Eine Ausnahme (erste Chance) des Typs "System.Reflection.TargetInvocationException" ist in mscorlib.dll aufgetreten.

    (i hope it's no problem, the Messages are in German...)

    ##################################################################################################

    To start synchronization i implemented a Button-Event in the Client-Form:
     
    private void button1_Click(object sender, EventArgs e)
            {
                 LocalDataCacheSyncAgent syncAgent = new LocalDataCacheSyncAgent();
                 syncAgent.Synchronize();
                 this.Form1_Load(null, null);
            }

    ##################################################################################################

    To initailize the Webservice on my Client is wrote the following code in the OnInitialized() Method on the Client:

     public partial class LocalDataCacheSyncAgent {
            partial void OnInitialized(){
             
                this.dbo_Customers.SyncDirection = Microsoft.Synchronization.Data.SyncDirection.Bidirectional;
              SyncService syncService = new SyncService();
                this.RemoteProvider = new ServerSyncProviderProxy(syncService);
            }
        }

    (SyncService is the Name of my ASP-Webservice)

    ##################################################################################################

    Can anybody help?

    Thanks a best regards,
    Thomas

    p.s. if wanted i could  send the hold solution to anyones emailadress...



    • Moved by Max Wang_1983 Friday, April 22, 2011 6:02 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, August 20, 2008 11:39 AM

Answers

All replies

  • ... i still cannot manage to solve the this problem... :-(

    everytime  the client executes the synchronize method, it raises en TargetInvocationException...

    i have the right dll's on device  (Synchronization.Data.dll and Synchronization.Data-SqlServerCe.dll for DEVICES) and my webservice use the Desktopversion...


    when i do initialize the syncagent direct with the webservice object i get an argument exception:

     private void button1_Click(object sender, EventArgs e)
    {      
    LocalDataCacheSyncAgent syncAgent = new LocalDataCacheSyncAgent(newSyncClient.SyncServiceSA.SyncServiceSA());
                 syncAgent.Synchronize();
                 this.Form1_Load(null, null);
            }


    strange...




    Friday, August 22, 2008 8:23 AM
  • are you using the sample shipped with the sync service for devices CTP ? are the tips/tricks in this post http://forums.microsoft.com/sync/ShowPost.aspx?PostID=3609978&SiteID=75 help?

     

    how is the Url string looks like for your application ? can you check it and debut it to your app to see if it is the right one ?

     

    notice you should not use http://localhost/mysite/services.asmx as the url since localhost cannot be detemined by the device.

     

    thanks

    Yunwen

    Saturday, August 23, 2008 3:14 PM
    Moderator
  • Hi,

    it works now!!

    The Problem was that i used the VS2008 integrated Webserver instead my IIS...after publishing the webservice on the IIS the synchronize method works properly!!

    And by the way it also does not work on my emulator, only on a real mobile device...

    thank you anyway!!

    cheers,
    thomas
    Tuesday, August 26, 2008 12:56 PM