2011-03-08 47 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項目只是一個普通的控制檯應用程序

相關問題