SyncKnowledge对象未传递给WCF服务

时间:2011-03-08 22:27:16

标签: microsoft-sync-framework

我正在尝试使用WCF将SQLCE数据库与SQL数据库同步。我有一个继承自KnowledgeSyncProvider的代理。我重写了以下方法(以及其他方法)

public override ChangeBatch GetChangeBatch(uint batchSize, SyncKnowledge destinationKnowledge, out object changeDataRetriever)
{ 

GetChangesParameters changesWrapper = proxy.GetChanges(batchSize, destinationKnowledge);

...

}

执行GetChangesParameters changesWrapper = proxy.GetChanges(batchSize, destinationKnowledge);代码时,出现以下错误

Retrieving the COM class factory for component with CLSID {EC413D66-6221-4EBB-AC55-4900FB321011} failed due to the following error: 80040154.

堆栈追踪:

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at WCF_Sync_Common.IRelationalSyncContract.GetChanges(UInt32 batchSize, SyncKnowledge destinationKnowledge)
   at ConsoleApplication10.RelationalProviderProxy.GetChangeBatch(UInt32 batchSize, SyncKnowledge destinationKnowledge, Object& changeDataRetriever) in C:\Users\amitesh.AKL\Documents\Visual Studio 2010\Projects\ConsoleApplication10\RelationalProviderProxy.cs:line 81
   at Microsoft.Synchronization.KnowledgeProviderProxy.GetChangeBatch(UInt32 dwBatchSize, ISyncKnowledge pSyncKnowledge, ISyncChangeBatch& ppChangeBatch, Object& ppUnkDataRetriever)

似乎错误与SyncKnowledge对象在线路上传递时有关。我试图在没有SyncKnowledge对象的情况下调用代理方法,并且能够调用该方法。但是只要我包含该对象,我就会收到上述错误。任何人都可以向我指出正确的方向指出我所缺少的东西

1 个答案:

答案 0 :(得分:0)

我设法通过创建WCF服务应用程序项目并将所有WCF代码移动到该项目来解决问题。我最初的WCF项目只是一个普通的控制台应用程序