473,383 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Passing a COM object as a parameter via Remoting

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!
Nov 15 '05 #1
6 2764
Hi Catherine,

First off there is no color that I can see in this post so it's a
bit difficult to follow. However, a couple of ideas come to mind.. No
firewall issues right?, Can you go back to the single directional
channels and verify that the port is actually open and ready to
recieve/transmit data? netstat...

else try...

TcpChannel channel = new TcpChannel(9000);
ChannelServices.RegisterChannel(channel);

SampleWellKnown objectWellKnown = new SampleWellKnown();

// After the channel is registered, the object needs to be registered
// with the remoting infrastructure. So, Marshal is called.
ObjRef objrefWellKnown = RemotingServices.Marshal(objectWellKnown,
"objectWellKnownUri");
Console.WriteLine("An instance of SampleWellKnown type is published at
{0}.", objrefWellKnown.URI);

Console.WriteLine("Press enter to unregister SampleWellKnown, so that
it is no longer available on this channel.");
Console.ReadLine();
RemotingServices.Disconnect(objectWellKnown);

Console.WriteLine("Press enter to end the server process.");
Console.ReadLine();

~~~~~~~~~~~~~
Tommie Carter
www.premiertechnology.com
--
"Catherine Jones" <no*@moreply.com> wrote in message news:<#Y**************@TK2MSFTNGP10.phx.gbl>...
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!

Nov 15 '05 #2
drop
ChannelServices.RegisterChannel (new TcpChannel(0));

on startup in the "process" throwing the exception.

about hanging .. you might be facing an STA thread lock due to reentrancy ..
have a look at this

http://www.dotnetremoting.cc/FAQs/Ha...pplication.asp (the
link might be invalid, ingo site has moved if i rememebr well)
you can download from here
(http://www.codearchitects.com/casubs...n/default.aspx) a message
brokering system implemented in .net remoting which shows how to handle
correctly the above mentioned issues.

p.s.: i think you should avoid passing com objects across machine and
process boundaries .. you are asking for troubles ..

there are security issues and marshaling implementatin bugs for some -
execution flow/object type passed - patterns

IMO

"Catherine Jones" <no*@moreply.com> wrote in message
news:#Y**************@TK2MSFTNGP10.phx.gbl...
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!

Nov 15 '05 #3
Hi Enrico

Thanks for your time.
Although I'm able to find the issue related to hanging problem

( it was due to reentrancy problem ),

I come up to two solutions for this problem to solve:

1. Is to span a new worker thread

2. to use Moniker ( using the api createObjRefMoniker )

I just want your input on, if using createObjRefMoniker is safe ?

Regards.

"enrico sabbadin @ infinito" <sabbadin@infinito_xyz.it> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
drop
ChannelServices.RegisterChannel (new TcpChannel(0));

on startup in the "process" throwing the exception.

about hanging .. you might be facing an STA thread lock due to reentrancy ... have a look at this

http://www.dotnetremoting.cc/FAQs/Ha...pplication.asp (the link might be invalid, ingo site has moved if i rememebr well)
you can download from here
(http://www.codearchitects.com/casubs...n/default.aspx) a message
brokering system implemented in .net remoting which shows how to handle
correctly the above mentioned issues.

p.s.: i think you should avoid passing com objects across machine and
process boundaries .. you are asking for troubles ..

there are security issues and marshaling implementatin bugs for some -
execution flow/object type passed - patterns

IMO

"Catherine Jones" <no*@moreply.com> wrote in message
news:#Y**************@TK2MSFTNGP10.phx.gbl...
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!


Nov 15 '05 #4
I've faced the problem in a message brokering system. In this case I put the
message in a .net queue , where another thread picks it up and deliver the
message. Using async delegate or the trhead pool is not an option if you
need to guarantee message / method call delivery order

I've never used createObjRefMoniker , will you elaborate on this option ?
"Catherine Jones" <no*@moreply.com> wrote in message
news:ez**************@TK2MSFTNGP12.phx.gbl...
Hi Enrico

Thanks for your time.
Although I'm able to find the issue related to hanging problem

( it was due to reentrancy problem ),

I come up to two solutions for this problem to solve:

1. Is to span a new worker thread

2. to use Moniker ( using the api createObjRefMoniker )

I just want your input on, if using createObjRefMoniker is safe ?

Regards.

"enrico sabbadin @ infinito" <sabbadin@infinito_xyz.it> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
drop
ChannelServices.RegisterChannel (new TcpChannel(0));

on startup in the "process" throwing the exception.

about hanging .. you might be facing an STA thread lock due to reentrancy
..
have a look at this

http://www.dotnetremoting.cc/FAQs/Ha...pplication.asp

(the
link might be invalid, ingo site has moved if i rememebr well)
you can download from here
(http://www.codearchitects.com/casubs...n/default.aspx) a message
brokering system implemented in .net remoting which shows how to handle
correctly the above mentioned issues.

p.s.: i think you should avoid passing com objects across machine and
process boundaries .. you are asking for troubles ..

there are security issues and marshaling implementatin bugs for some -
execution flow/object type passed - patterns

IMO

"Catherine Jones" <no*@moreply.com> wrote in message
news:#Y**************@TK2MSFTNGP10.phx.gbl...
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!



Nov 15 '05 #5
Hello Enrico
Firstly thanks a lot for all your help and time.
I really appreciate that you are following up with me here.
Please help me resolve the issue.
We're making an MTA thread ( by default all the worker threads are MTA ) and there by we are marshalling our com object in this thread using
RuntimeServices.Marshal() and then unmarshal it in the worker thread using RuntimeServices.UnMarshal() and then call the method on server

passing this marshalled object.So what happens is that the Trasparent Proxy object lies with the main thread whereas the servercall goes on the child thread.

We prototyped it and it seems to work fine.

createObjRefMoniker :

Well in this case we create a named moniker of our com object and pass that name to server instead of the object itself, now using this name we get the com object reference on server and call the method on this.

Regards

Catherine
"enrico sabbadin @ infinito" <sabbadin@infinito_xyz.it> wrote in message news:%2******************@tk2msftngp13.phx.gbl...
I've faced the problem in a message brokering system. In this case I put the
message in a .net queue , where another thread picks it up and deliver the
message. Using async delegate or the trhead pool is not an option if you
need to guarantee message / method call delivery order

I've never used createObjRefMoniker , will you elaborate on this option ?


"Catherine Jones" <no*@moreply.com> wrote in message
news:ez**************@TK2MSFTNGP12.phx.gbl...
Hi Enrico

Thanks for your time.
Although I'm able to find the issue related to hanging problem

( it was due to reentrancy problem ),

I come up to two solutions for this problem to solve:

1. Is to span a new worker thread

2. to use Moniker ( using the api createObjRefMoniker )

I just want your input on, if using createObjRefMoniker is safe ?

Regards.

"enrico sabbadin @ infinito" <sabbadin@infinito_xyz.it> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
drop
ChannelServices.RegisterChannel (new TcpChannel(0));

on startup in the "process" throwing the exception.

about hanging .. you might be facing an STA thread lock due to reentrancy
..
have a look at this

http://www.dotnetremoting.cc/FAQs/Ha...pplication.asp

(the
link might be invalid, ingo site has moved if i rememebr well)
you can download from here
(http://www.codearchitects.com/casubs...n/default.aspx) a message
brokering system implemented in .net remoting which shows how to handle
correctly the above mentioned issues.

p.s.: i think you should avoid passing com objects across machine and
process boundaries .. you are asking for troubles ..

there are security issues and marshaling implementatin bugs for some -
execution flow/object type passed - patterns

IMO

"Catherine Jones" <no*@moreply.com> wrote in message
news:#Y**************@TK2MSFTNGP10.phx.gbl...
> 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!
>
>



Nov 15 '05 #6
thanks about the info on createObjRefMoniker.

using :
RuntimeServices.Marshal() and then unmarshal it in the worker thread using
RuntimeServices.UnMarshal() and then call the method on server

sounds like the coorect equivalent of what you had to do on native code , so
i think you are in the correct path

however, another option i think of is to use the GIT (global interface
table) to (marshal once, get a token, unmarshal (many times) using the
token)

btw , did you solve
------
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."
------

dropping
ChannelServices.RegisterChannel (new TcpChannel(0));
on the client side ?
"Catherine Jones" <no*@moreply.com> wrote in message
news:u3*************@tk2msftngp13.phx.gbl...
Hello Enrico
Firstly thanks a lot for all your help and time.
I really appreciate that you are following up with me here.
Please help me resolve the issue.
We're making an MTA thread ( by default all the worker threads are MTA ) and
there by we are marshalling our com object in this thread using
RuntimeServices.Marshal() and then unmarshal it in the worker thread using
RuntimeServices.UnMarshal() and then call the method on server

passing this marshalled object.So what happens is that the Trasparent Proxy
object lies with the main thread whereas the servercall goes on the child
thread.

We prototyped it and it seems to work fine.

createObjRefMoniker :

Well in this case we create a named moniker of our com object and pass that
name to server instead of the object itself, now using this name we get the
com object reference on server and call the method on this.

Regards

Catherine
"enrico sabbadin @ infinito" <sabbadin@infinito_xyz.it> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
I've faced the problem in a message brokering system. In this case I put the message in a .net queue , where another thread picks it up and deliver the
message. Using async delegate or the trhead pool is not an option if you
need to guarantee message / method call delivery order

I've never used createObjRefMoniker , will you elaborate on this option ?
"Catherine Jones" <no*@moreply.com> wrote in message
news:ez**************@TK2MSFTNGP12.phx.gbl...
Hi Enrico

Thanks for your time.
Although I'm able to find the issue related to hanging problem

( it was due to reentrancy problem ),

I come up to two solutions for this problem to solve:

1. Is to span a new worker thread

2. to use Moniker ( using the api createObjRefMoniker )

I just want your input on, if using createObjRefMoniker is safe ?

Regards.

"enrico sabbadin @ infinito" <sabbadin@infinito_xyz.it> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
drop
ChannelServices.RegisterChannel (new TcpChannel(0));

on startup in the "process" throwing the exception.

about hanging .. you might be facing an STA thread lock due to reentrancy
..
have a look at this

http://www.dotnetremoting.cc/FAQs/Ha...pplication.asp
(the
link might be invalid, ingo site has moved if i rememebr well)
you can download from here
(http://www.codearchitects.com/casubs...n/default.aspx) a message
brokering system implemented in .net remoting which shows how to
handle correctly the above mentioned issues.

p.s.: i think you should avoid passing com objects across machine and
process boundaries .. you are asking for troubles ..

there are security issues and marshaling implementatin bugs for some -
execution flow/object type passed - patterns

IMO

"Catherine Jones" <no*@moreply.com> wrote in message
news:#Y**************@TK2MSFTNGP10.phx.gbl...
> 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!
>
>



Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ken Allen | last post by:
I have a .net client/server application using remoting, and I cannot get the custom exception class to pass from the server to the client. The custom exception is derived from ApplicationException...
4
by: Sahil Malik [MVP] | last post by:
Okay so now I understand (surprised though) - that WebServices can indeed pass ByRef/ref parameters. All I have to do is mark an integer parameter of a WebMethod as "ref". Funnily enough, this is...
9
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting...
1
by: Rich | last post by:
I need to build a managed DLL in C++ and call it from C#. I need this to work with remoting as well. In C#, class objects are reference types, so if an object is passed directly to a C++ method...
2
by: Rich | last post by:
I need to build a managed DLL in C++ and call it from C#. I need this to work with remoting as well. In C#, class objects are reference types, so if an object is passed directly to a C++ method...
3
by: Hakan Örnek | last post by:
Hi , I want to parameter passing to my windows sevice. I call service commands like this ; '------------------------------------------------------------ Dim sc As ServiceController sc = New...
7
by: =?iso-8859-1?Q?S=F8ren_M._Olesen?= | last post by:
Hi How do I pass a complex type to a webservice?? What I have is a Class 'MyComplexClass' which lives in it's own dll/namespace. I'd like to pass this class to my webmethod: <WebMethod()_...
3
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, I am using dotnet remoting with a binarry formatter. I have a property that returns a memorystream that has had a file loaded into it. When I try to access this property though I get an...
3
by: JB | last post by:
Hi All, I've discovered a strange behaviour with Object parameters passed ByVal via remoting and I'm wondering if anybody could shed some light on this. In a non remoting function call, when...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.