tags:

views:

254

answers:

2

I've created a .net class derived from ServicedComponent and registered it with COM+. The interface that this component implements has a method that returns an IDataReader. When I call the serviced component from my client application everything works I can call the method that returns the IDataReader no problem but as soon as I call a method on the object I get the exception: "System.Runtime.Remoting.RemotingException : This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server."

I hacked my code a fair bit and realized that it would work if I created my own implementation of IDataReader that was serializable (has the Serializable attribute). If the implementation derives from MarshalByRefObject it fails.

So, is it possible to return standard .net objects by reference from COM+ ServicedComponents and if so what do I need to do to achieve it?

+1  A: 

An interesting article about COM interop with C#, hope it helps:

http://www.codeproject.com/KB/COM/cominterop.aspx

Ricky AH
+1  A: 

When your COM+ client and COM+ component are both managed, the CLR tries to be "smart" and attempts to switch to using .Net remoting as a communication channel.

To make this scenario work, you can register a remoting channel for your object that implements IDataReader.

Unofrtunately, I have no access to the code where I did this couple of years ago, so I can't post a sample. :-(

Franci Penov