I have merge replication set up on a SQL Server 2014 instance to SQL Server CE 3.5. The publication, publisher, distributor and IIS have all been set up.
Here's the code snippet:
string localDBPath = @"C:\Documents and Settings\Robert\Desktop\MyDB.sdf";
SqlCeReplication replicator = new SqlCeReplication();
replicator.InternetUrl = "http://myWebServer/sqlcesa35.dll";
replicator.Publisher = "mySqlServer";
replicator.PublisherDatabase = "myDatabase";
replicator.PublisherSecurityMode = SecurityType.NTAuthentication;
replicator.Publication = "myPublication";
replicator.Subscriber = "myPublication";
replicator.SubscriberConnectionString = @"Data Source='" + localDBPath + "'";
replicator.ExchangeType = ExchangeType.BiDirectional;
replicator.AddSubscription(AddOption.CreateDatabase);
replicator.Synchronize();
Unfortunately, this code fails at the replicator.Synchronize
line with the following error message:
server agent is unable to connect to the publisher
SQL Server Agent is running fine and the Snapshot Agent was completed successfully on the publication too. I'm not sure what am I missing. Any ideas?