2011-03-08 85 views
0

我正尝试使用WCF与SQL数据库同步SQLCE数据库。我有一个继承自KnowledgeSyncProvider的代理。我重写(其中包括)以下方法未将SyncKnowledge对象传递给WCF服务

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对象的代理方法,并能够调用该方法。但只要我包含对象,我就会得到上述错误。任何人都可以解释,指向我正确的方向上我缺少的东西

回答

0

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