I'm trying to get SQL Server 2022 setup to use merge pull replication. Topography has the publisher/distributor on the same server, with a second server running IIS for clients to connect to. Client machines are running SQL Server 2022 Express. All machines are running SQL Server 2022 - v16.0.4003.
The client machines run a small application that handles syncing, using the RMO library. I've included the code snippet below.
When I configure the agent object to use Web Sync, it throws an error
0x80004002: No such interface supported.
I can remove these settings, and syncing will attempt to run. However, it won't use web syncing.
Using the replmerg console application, web syncing will function correctly. Based on this, I'm assuming that the server configuration is correct.
In the below snipped, I've added in a bunch of error trapping, none of which shows anything more detailed than the no such interface supported. Agent.Output is blank, agent.ComErrorCollection is empty.
Any ideas would be appreciated
ServerConnection conn = new Microsoft.SqlServer.Management.Common.ServerConnection(settings.SubscriberName);
MergePullSubscription subscription = new MergePullSubscription();
MergeSynchronizationAgent agent;
conn.Connect();
subscription.ConnectionContext = conn;
subscription.DatabaseName = settings.LocalDBName;
subscription.PublisherName = settings.PublisherName;
subscription.PublicationDBName = settings.PublicationDBName;
subscription.PublicationName = settings.PublicationName;
if (subscription.LoadProperties())
{
agent = subscription.SynchronizationAgent;
agent.Distributor = settings.PublisherName;
agent.DistributorSecurityMode = Microsoft.SqlServer.Replication.SecurityMode.Integrated;
agent.PublisherSecurityMode = Microsoft.SqlServer.Replication.SecurityMode.Integrated;
agent.HostName = Environment.MachineName;
agent.SubscriptionType = SubscriptionOption.Pull;
agent.ExchangeType = MergeExchangeType.Bidirectional;
agent.DownloadGenerationsPerBatch = 200;
agent.UploadGenerationsPerBatch = 200;
agent.InternetTimeout = settings.TimeoutSeconds;
agent.OutputVerboseLevel = 2;
agent.UseWebSynchronization = true;
agent.InternetSecurityMode = SecurityMode.Standard;
agent.InternetUrl = settings.ReplicationURL;
agent.InternetLogin = settings.ReplicationUsername;
agent.InternetPassword = settings.ReplicationPassword;
try
{
agent.Synchronize();
}
catch (Exception ex)
{
foreach (ComErrorRecord comError in agent.ComErrorCollection)
{
log.Debug($"Com Error: {comError.ErrorNumber}: {comError.Description}");
}
log.Debug("Agent Output: " + agent.Output);
log.Error("Error in Syncronize (" + settings.SubscriberName + "): " + ex.Message);
EmailLog.Error("Error in Syncronize (" + settings.SubscriberName + "): " + ex.Message);
}
}