C
Catherine Jones
Hi all, we need urgent help in a matter.
We are trying to pass a COM object from the client to server and are
facing some problems in the same.
We've our client in C# as well as the Server in C# and we're using
remoting for client to server communication.
Out client first creates an object of type System.__ComObject and
then passes it to our server using remoting, the
scenario can be visualized as :-
Com Server
Component A Exposing Interface IA and IB
C# Client
Type comType = Type.GetTypeFromCLSID( CLSID_A )
object objDisp = Activator.CreateInstance( comType );
TcpChannel chnl = new TcpChannel( 8086 );
ChannelServices.RegisterChannel( chnl );
//Through Reflection now we call a method on this IA which returns
Dispatch of IB ( in C# we get this as System.__ComObject )
Now we're creating a CAO for our component CSA and call the method
which expects as parameter the System.__ComObject Created earlier
RemotingConfiguration.RegisterActivatedClientType( typeof( CSA ),
"tcp://8085" );
CSA objCSA = new CSA.CSA();
objCSA.getSomething( objDisp );
C# Assembly
Component CSA
protected object m_objSess;
CSA::getSomething( objDisp )
{
m_objSess = objDisp;
//Now using reflection we call a method of this
System.__ComObject passed as parameter
}
C# Server
BinaryServerFormatterSinkProvider prov = new
BinaryServerFormatterSinkProvider();
prov.TypeFilterLevel = TypeFilterLevel.Full;
IDictionary prop = new HashTable();
prop["port"] = 8085;
TcpChannel chnl = new TcpChannel( prop, null, prov );
ChannelServices.RegisterChannel( chnl );
RemotingConfiguration.RegisterActivatedServiceType( typeof( CSA ) );
System.Console.Readline();
Now on executing the code ,at line marked in red it throws an
exception telling that "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."
To remove this we opened a bi-directional ( as shown in the code
with blue color ) channel but when we do this the call hangs ( does not come
out ) from the line marked in red ( while invoking the method using
reflection ).
Could you please throw some light on the missing snippets of code if
any and provide us some guideline as to how to proceed to make the calls
successful.
Thanks a lot for your time!
We are trying to pass a COM object from the client to server and are
facing some problems in the same.
We've our client in C# as well as the Server in C# and we're using
remoting for client to server communication.
Out client first creates an object of type System.__ComObject and
then passes it to our server using remoting, the
scenario can be visualized as :-
Com Server
Component A Exposing Interface IA and IB
C# Client
Type comType = Type.GetTypeFromCLSID( CLSID_A )
object objDisp = Activator.CreateInstance( comType );
TcpChannel chnl = new TcpChannel( 8086 );
ChannelServices.RegisterChannel( chnl );
//Through Reflection now we call a method on this IA which returns
Dispatch of IB ( in C# we get this as System.__ComObject )
Now we're creating a CAO for our component CSA and call the method
which expects as parameter the System.__ComObject Created earlier
RemotingConfiguration.RegisterActivatedClientType( typeof( CSA ),
"tcp://8085" );
CSA objCSA = new CSA.CSA();
objCSA.getSomething( objDisp );
C# Assembly
Component CSA
protected object m_objSess;
CSA::getSomething( objDisp )
{
m_objSess = objDisp;
//Now using reflection we call a method of this
System.__ComObject passed as parameter
}
C# Server
BinaryServerFormatterSinkProvider prov = new
BinaryServerFormatterSinkProvider();
prov.TypeFilterLevel = TypeFilterLevel.Full;
IDictionary prop = new HashTable();
prop["port"] = 8085;
TcpChannel chnl = new TcpChannel( prop, null, prov );
ChannelServices.RegisterChannel( chnl );
RemotingConfiguration.RegisterActivatedServiceType( typeof( CSA ) );
System.Console.Readline();
Now on executing the code ,at line marked in red it throws an
exception telling that "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."
To remove this we opened a bi-directional ( as shown in the code
with blue color ) channel but when we do this the call hangs ( does not come
out ) from the line marked in red ( while invoking the method using
reflection ).
Could you please throw some light on the missing snippets of code if
any and provide us some guideline as to how to proceed to make the calls
successful.
Thanks a lot for your time!