C# 在我的基于VB的网站中同步SQL Server 2014和SQL Server 2014 Express数据库问题.net 4.0不支持此类接口
我已在IIS 10和Window10(x64)上设置了我的网站,并在我的网站中引用了SQL Server 2014 Express RMO库,但我收到一个错误: Microsoft.SqlServer.Replication.Com错误异常:“不支持此类接口” 当我打电话给C# 在我的基于VB的网站中同步SQL Server 2014和SQL Server 2014 Express数据库问题.net 4.0不支持此类接口,c#,sql,sql-server,C#,Sql,Sql Server,我已在IIS 10和Window10(x64)上设置了我的网站,并在我的网站中引用了SQL Server 2014 Express RMO库,但我收到一个错误: Microsoft.SqlServer.Replication.Com错误异常:“不支持此类接口” 当我打电话给 Microsoft.SqlServer.Replication.MergeSynchronizationAgent.Synchronize() 方法。我遵循了示例中定义的相同代码 // Define the serve
Microsoft.SqlServer.Replication.MergeSynchronizationAgent.Synchronize()
方法。我遵循了示例中定义的相同代码
// Define the server, publication, and database names.
string subscriberName = subscriberInstance;
string publisherName = publisherInstance;
string distributorName = distributorInstance;
string publicationName = "AdvWorksSalesOrdersMerge";
string subscriptionDbName = "AdventureWorks2012Replica";
string publicationDbName = "AdventureWorks2012";
string hostname = @"adventure-works\garrett1";
string webSyncUrl = "https://" + publisherInstance + SalesOrders/replisapi.dll";
// Create a connection to the Subscriber.
ServerConnection conn = new ServerConnection(subscriberName);
MergePullSubscription subscription;
MergeSynchronizationAgent agent;
try
{
// Connect to the Subscriber.
conn.Connect();
// Define the pull subscription.
subscription = new MergePullSubscription();
subscription.ConnectionContext = conn;
subscription.DatabaseName = subscriptionDbName;
subscription.PublisherName = publisherName;
subscription.PublicationDBName = publicationDbName;
subscription.PublicationName = publicationName;
// If the pull subscription exists, then start the synchronization.
if (subscription.LoadProperties())
{
// Get the agent for the subscription.
agent = subscription.SynchronizationAgent;
// Check that we have enough metadata to start the agent.
if (agent.PublisherSecurityMode == null)
{
// Set the required properties that could not be returned
// from the MSsubscription_properties table.
agent.PublisherSecurityMode = SecurityMode.Integrated;
agent.DistributorSecurityMode = SecurityMode.Integrated;
agent.Distributor = publisherName;
agent.HostName = hostname;
// Set optional Web synchronization properties.
agent.UseWebSynchronization = true;
agent.InternetUrl = webSyncUrl;
agent.InternetSecurityMode = SecurityMode.Standard;
agent.InternetLogin = winLogin;
agent.InternetPassword = winPassword;
}
// Enable agent output to the console.
agent.OutputVerboseLevel = 1;
agent.Output = "";
// Synchronously start the Merge Agent for the subscription.
agent.Synchronize();
}
else
{
// Do something here if the pull subscription does not exist.
throw new ApplicationException(String.Format(
"A subscription to '{0}' does not exist on {1}",
publicationName, subscriberName));
}
}
catch (Exception ex)
{
// Implement appropriate error handling here.
throw new ApplicationException("The subscription could not be " +
"synchronized. Verify that the subscription has " +
"been defined correctly.", ex);
}
finally
{
conn.Disconnect();
}
您是否遵循了以下网站中的所有步骤?是否从VisualStudio菜单项目中添加了库:添加引用?您可以在“参考”下的“解决方案资源管理器”中进行验证。我遵循了那篇文章中定义的相同步骤,我认为对发布服务器、分发服务器和订阅服务器的SQL server版本支持是有意义的。因为我已经用SQL server 2016标准和SQL express 2014版本对其进行了测试。工作正常。但是,SQL server 2014标准和SQL express 2014没有提供此类接口支持问题。有一个2014版的msdn网页:。所以我不认为这是一个版本。您使用的是Standard还是Express?Express并没有所有的功能。你可能错过了一个图书馆。您是在working case中使用NET4.0还是更高版本?您可能需要发布应用程序并在IIS上安装,IIS将获取缺少的dll(其中包含库)并使用缺少的库更新IIS。我有版本为12.0.5589的sql server 2014标准,以及版本为x64位的sql express 2014 v 12.0.5589的相同标准。我遵循了文章中描述的所有步骤。当我在客户端或windows控制台应用程序上使用web应用程序中的RMO调用它时,调用代理.synchronize()方法时都会出现“不支持此类接口”错误。我不是SQL授权方面的专家。我认为发生的是,您的标准没有正确安装许可证,因此默认为express options。见: