locked
SQL To SQL N-Tier 2.0/.1 WCF binding for off domain computer - Unable to cast COM object of type 'System.__ComObject' to interface type 'ISyncChangeBatchBase2 RRS feed

  • Question

  • I have been trying to get a WCF  binding to work for an adapted SQL Server and SQL Express N-Tier” sample  that will allow a client off of the domain to sync changes. I have had little success with disabling security in the binding and enabling reliablesession to get session support, but the sync will throw errors with or without batching, I am not too concerned with security, as these computers are on a private network at all times, ie not internet accessible. 


    also, the sync data will be propagated,as it shows up in the destination DB (doing one way syncs) , but throws an error before the sync process is ended. there are 2 errors that I see depending on what way I am syncing. one complains about ISyncChangeBatchBase2 (full error below), the other about  ISyncKnowledge. I am not sure what is happening I was hoping the community may help shine some light, or share a workaround in order to get the off domain computer to sync. 

     

    these errors only pop up when I want to sync actual data, when there is nothing to sync, it seems to exit the code properly.

     

    WSHttpBinding binding = new WSHttpBinding();

    binding.ReaderQuotas.MaxArrayLength = 2147483647;

    binding.MaxReceivedMessageSize = 2147483647;

    //modified part, disable security, enable reliable session to get session support    

    binding.ReliableSession.Enabled = true;

    binding.Security.Mode = SecurityMode.None;           

            

    <wsHttpBinding>

            <!-- We are using Server cert only.-->

            <binding name="largeMessageHttpBinding" maxReceivedMessageSize="2147483647">

              <readerQuotas maxArrayLength="2147483647"/>

              <reliableSession enabled="true" />

              <security mode="None"/>

            </binding>

    </wsHttpBinding>

     

     

    {"Unable to cast COM object of type 'System.__ComObject' to interface type 'ISyncChangeBatchBase2'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{6FDB596A-D755-4584-BD0C-C0C23A548FBF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."}

     

    "\r\nServer stack trace: \r\n   at System.ServiceModel.Channels.CommunicationObject.ThrowPending()\r\n   at System.ServiceModel.Channels.CommunicationObject.ThrowIfClosed()\r\n   at System.ServiceModel.Channels.ReliableRequestSessionChannel.CreateTerminateRequestor()\r\n   at System.ServiceModel.Channels.ReliableRequestSessionChannel.TerminateSequence(TimeSpan timeout)\r\n   at System.ServiceModel.Channels.ReliableRequestSessionChannel.OnClose(TimeSpan timeout)\r\n   at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)\r\n   at System.ServiceModel.Channels.ServiceChannel.OnClose(TimeSpan timeout)\r\n   at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout)\r\n   at System.ServiceModel.Dispatcher.TerminatingOperationBehavior.AfterReply(ProxyRpc& rpc)\r\n   at System.ServiceModel.Channels.ServiceChannel.TerminateIfNecessary(ProxyRpc& rpc)\r\n   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)\r\n   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)\r\n   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n   at WebSyncContract.IRelationalSyncContract.Cleanup()\r\n   at WebSyncContract.RelationalProviderProxy.CloseProxy() in C:\\Programing Source Code\\TireTracker\\TireTrackerBase\\WebSyncContract\\RelationalProviderProxy.cs:line 247\r\n   at TireTrackerSyncApp.Form1.button5_Click(Object sender, EventArgs e) in C:\\Programing Source Code\\TireTracker\\TireTrackerBase\\TireTrackerSyncApp\\Form1.cs:line 296"

     

    MS Server 2003 both sides

    SQLExpress 2008 R2 both sides, 

     

     

     

    Any insight would help.

     

    • Edited by Racing_Prog Wednesday, September 8, 2010 12:56 PM details
    Wednesday, September 8, 2010 12:53 PM

Answers

  • based on docs (am not sure if you've seen this already):

    Managed Application Throws System.Runtime.InteropServices.COMException (0x80004002)

    A managed synchronization application throws System.Runtime.InteropServices.COMException with the following error message: "Unable to cast COM object of type 'Sync Framework Managed Class' to interface type 'Sync Framework COM Interop Class'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{73EA794F-1251-4466-A19C-DAEAF5BDBD04}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

    This exception occurs when a Sync Framework object is created in one single-threaded apartment and a method of the object is called from a different single-threaded apartment. In this case, the .NET Framework tries to marshal the Sync Framework object from one apartment to the other by querying the Sync Framework object for the IMarshal interface. Sync Framework objects do not implement IMarshal and so the call fails with this exception.

    Solution
    Use multithreaded apartment (MTA) threads. Marshaling is not required for MTA threads.

    • Marked as answer by Racing_Prog Wednesday, September 8, 2010 2:27 PM
    Wednesday, September 8, 2010 2:21 PM

All replies

  • Found this http://social.microsoft.com/Forums/en/syncdevdiscussions/thread/7d6de545-11a5-4b60-be6e-a8aa888bf63b

     

    Marked the sync app i created as MTA and the sync seems to work, I will continue to test to verify, but this is an odd issue to come up just by disabling security.

    Wednesday, September 8, 2010 2:14 PM
  • based on docs (am not sure if you've seen this already):

    Managed Application Throws System.Runtime.InteropServices.COMException (0x80004002)

    A managed synchronization application throws System.Runtime.InteropServices.COMException with the following error message: "Unable to cast COM object of type 'Sync Framework Managed Class' to interface type 'Sync Framework COM Interop Class'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{73EA794F-1251-4466-A19C-DAEAF5BDBD04}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

    This exception occurs when a Sync Framework object is created in one single-threaded apartment and a method of the object is called from a different single-threaded apartment. In this case, the .NET Framework tries to marshal the Sync Framework object from one apartment to the other by querying the Sync Framework object for the IMarshal interface. Sync Framework objects do not implement IMarshal and so the call fails with this exception.

    Solution
    Use multithreaded apartment (MTA) threads. Marshaling is not required for MTA threads.

    • Marked as answer by Racing_Prog Wednesday, September 8, 2010 2:27 PM
    Wednesday, September 8, 2010 2:21 PM
  • based on docs (am not sure if you've seen this already):

    Managed Application Throws System.Runtime.InteropServices.COMException (0x80004002)

    A managed synchronization application throws System.Runtime.InteropServices.COMException with the following error message: "Unable to cast COM object of type 'Sync Framework Managed Class' to interface type 'Sync Framework COM Interop Class'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{73EA794F-1251-4466-A19C-DAEAF5BDBD04}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."

    This exception occurs when a Sync Framework object is created in one single-threaded apartment and a method of the object is called from a different single-threaded apartment. In this case, the .NET Framework tries to marshal the Sync Framework object from one apartment to the other by querying the Sync Framework object for the IMarshal interface. Sync Framework objects do not implement IMarshal and so the call fails with this exception.

    Solution
    Use multithreaded apartment (MTA) threads. Marshaling is not required for MTA threads.

    Yea, thats the link I had found as well, It seems to be working now, I am populating a test database right now to see if it still holds up under lots o stress...
    Wednesday, September 8, 2010 2:27 PM