I am currently developing a bridge between a database and a sql server database android (sqlite).
To do this, I use a web service and filtered replications with sqlce databases stored on a server IIS 7. To develop this, I used IIS Express on my pc. Everything works fine on my pc but when deployed, replicated databases create a new subscription for each synchronization (while on IIS Express sync works without creating a new subscription), no exceptions are thrown, nothing.
I don't understand why IIS 7 or IIS Express works in a different way to sync databases.
An idea of the reason of the problem?
I use Sql replication ce 3.5 sp2, Sql server 2008 R2 as mother database, IIS7.
I tried to : -Replicate motherdatabase with a little software on the webserver, it works. -Use "SqlCeReplication.loadproperties" to find my sqlce database parameters to avoid the creation of the new subscription, it doesn't work.
Other details : -When it is not syncing for the first time, webservices don't do "repl.AddSubscription(AddOption.CreateDatabase)", I already check that.
Here is the code used to sync :
' Define the server, publication, and database names.
Dim repl As SqlCeReplication = Nothing
Try
repl = New SqlCeReplication
repl.Publisher = PublisherName
repl.PublisherLogin = login
repl.PublisherPassword = password
repl.PublisherSecurityMode = SecurityType.DBAuthentication
repl.PublisherDatabase = My.Settings.DBName
repl.Publication = PublicationName
repl.InternetUrl = "https://iis.mydomain.com:444/sql/sqlcesa35.dll"
repl.InternetLogin = "sync"
repl.InternetPassword = "dfssd"
repl.Subscriber = "MobileApp - " & login
repl.SubscriberConnectionString = "Data Source=" & My.Settings.folderDB + "\" + subscriptionName + ".sdf"
If Not File.Exists(My.Settings.dossierBDD + "\" + subscriptionName + ".sdf") Then
repl.AddSubscription(AddOption.CreateDatabase)
End If
repl.Synchronize()
Catch err As SqlCeException
Finally
repl.Dispose()
repl = Nothing
End Try
Thanks in advance
I found myself the answer... I don't really know why but if you want to do merge replication on sqlce, you will need to let the IIS website "Load the user profile" (on the application pool), otherwise subscription are created each time...