locked
Sync Services for ADO.Net 2.0 - Move Database to Different Server RRS feed

  • Question

  • I built an application for occasionally connected devices where the SQL Server Compact Edition database in the mobile application (clients)  synchronize with a SQL Server 2008 database (server) using Sync Services for ADO.Net 2.0.

    The Sync Service is hosted on the server using IIS 7. A WCF Service is used to connect the cl;ients to the server for synchronization.

    I would like to move the location of the server database from the current instance of SQL Server 2008 Express to a new instance of SQL Server 2008. I installed the new instance, backed up the database on the current instance and restored it to the new instance. The database is now up and running on the new instance of SQL server.

    I wanted to redirect the Sync Service from the database on the older instance to the new instance of SQL server. I opened the web.config file for the sync service and changed the connection string so that it now pointed at the database on the new instance of SQL server.

    I tested the new arrangement by synchronizing the database on a mobile device to the server. I added several new records to one of the tables on the mobile client, then synchronized. It all seemed to work, the changes were uploaded, but they ended up in the table in the database on the old instance of SQL Server. Something is still pointing back at the old instance.

    I thought that by changing the connection string in the web.config file I could point the synchronization at the database on the new instance of SQL server.

    Should this have worked? Do I need to go back into Visual Studio and modify the service and recompile it in order to change the database location? I was hoping to not have to do that.

     

    Thanks.

     

    Sunday, July 18, 2010 1:21 AM

Answers

  • I was able to get it working by going back to visual studio, changing the connection string, rebuilding the sevice and replacing the service files used by the web service. There should be an easier way to do it. I would expect there would be a way to change the configuration on the server, but I was unable to find it. When I have more time I will try again, will post if I find anything.
    Wednesday, August 11, 2010 2:14 AM

All replies

  • just do a Find/Search for any hard-coded connection string in your application or re-check that you modified the right config file/entry for your application.
    Sunday, July 18, 2010 2:40 PM
  • Thanks. I tried what you suggested and found no other references to the connection string besides the one in the application settings file and the app config file.

    It is my understanding that these become the web.config file, which is where I altered the connection string on the server.

     

    I am missing something here and will continue to look.

     

    Thank you for your help.

    Monday, July 19, 2010 10:48 AM
  • am pretty sure Sync Fx never stores connection strings internally, so it is most likely that there is something in the code or config files that is set incorrectly that's being picked up.
    Tuesday, July 20, 2010 1:38 AM
  • Hi Giantocr73,

    Just wanted to know if you were you able to troubleshoot the problem?

    Wednesday, July 21, 2010 6:45 PM
  • Still working on it. Going slowly since the sync service is being used daily and I need to keep the data coming even if it going into the wrong database.

    I beleive the problem is I have been updating the web.config file of the wcf service website that is hosting the sync service on iis. I am trying to figure out how to alter the syncservice.dll files in the bin folder of the web site.

    I will let you know how it ends up.

    Thursday, July 22, 2010 2:59 AM
  • I was able to get it working by going back to visual studio, changing the connection string, rebuilding the sevice and replacing the service files used by the web service. There should be an easier way to do it. I would expect there would be a way to change the configuration on the server, but I was unable to find it. When I have more time I will try again, will post if I find anything.
    Wednesday, August 11, 2010 2:14 AM