473,739 Members | 5,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.__ComObj ect 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.GetTypeFro mCLSID( CLSID_A )

object objDisp = Activator.Creat eInstance( comType );

TcpChannel chnl = new TcpChannel( 8086 );

ChannelServices .RegisterChanne l( chnl );

//Through Reflection now we call a method on this IA which returns

Dispatch of IB ( in C# we get this as System.__ComObj ect )

Now we're creating a CAO for our component CSA and call the method

which expects as parameter the System.__ComObj ect Created earlier

RemotingConfigu ration.Register ActivatedClient Type( typeof( CSA ),

"tcp://8085" );

CSA objCSA = new CSA.CSA();

objCSA.getSomet hing( objDisp );



C# Assembly

Component CSA

protected object m_objSess;

CSA::getSomethi ng( objDisp )

{

m_objSess = objDisp;

//Now using reflection we call a method of this

System.__ComObj ect passed as parameter
}



C# Server

BinaryServerFor matterSinkProvi der prov = new

BinaryServerFor matterSinkProvi der();

prov.TypeFilter Level = TypeFilterLevel .Full;
IDictionary prop = new HashTable();
prop["port"] = 8085;

TcpChannel chnl = new TcpChannel( prop, null, prov );

ChannelServices .RegisterChanne l( chnl );

RemotingConfigu ration.Register ActivatedServic eType( typeof( CSA ) );

System.Console. Readline();


Now on executing the code ,at line marked in red it throws an

exception telling that "System.Runtime .Remoting.Remot ingException: 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 2799
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 .RegisterChanne l(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 = RemotingService s.Marshal(objec tWellKnown,
"objectWellKnow nUri");
Console.WriteLi ne("An instance of SampleWellKnown type is published at
{0}.", objrefWellKnown .URI);

Console.WriteLi ne("Press enter to unregister SampleWellKnown , so that
it is no longer available on this channel.");
Console.ReadLin e();
RemotingService s.Disconnect(ob jectWellKnown);

Console.WriteLi ne("Press enter to end the server process.");
Console.ReadLin e();

~~~~~~~~~~~~~
Tommie Carter
www.premiertechnology.com
--
"Catherine Jones" <no*@moreply.co m> wrote in message news:<#Y******* *******@TK2MSFT NGP10.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.__ComObj ect 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.GetTypeFro mCLSID( CLSID_A )

object objDisp = Activator.Creat eInstance( comType );

TcpChannel chnl = new TcpChannel( 8086 );

ChannelServices .RegisterChanne l( chnl );

//Through Reflection now we call a method on this IA which returns

Dispatch of IB ( in C# we get this as System.__ComObj ect )

Now we're creating a CAO for our component CSA and call the method

which expects as parameter the System.__ComObj ect Created earlier

RemotingConfigu ration.Register ActivatedClient Type( typeof( CSA ),

"tcp://8085" );

CSA objCSA = new CSA.CSA();

objCSA.getSomet hing( objDisp );



C# Assembly

Component CSA

protected object m_objSess;

CSA::getSomethi ng( objDisp )

{

m_objSess = objDisp;

//Now using reflection we call a method of this

System.__ComObj ect passed as parameter
}



C# Server

BinaryServerFor matterSinkProvi der prov = new

BinaryServerFor matterSinkProvi der();

prov.TypeFilter Level = TypeFilterLevel .Full;
IDictionary prop = new HashTable();
prop["port"] = 8085;

TcpChannel chnl = new TcpChannel( prop, null, prov );

ChannelServices .RegisterChanne l( chnl );

RemotingConfigu ration.Register ActivatedServic eType( typeof( CSA ) );

System.Console. Readline();


Now on executing the code ,at line marked in red it throws an

exception telling that "System.Runtime .Remoting.Remot ingException: 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 .RegisterChanne l (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.co m> wrote in message
news:#Y******** ******@TK2MSFTN GP10.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.__ComObj ect 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.GetTypeFro mCLSID( CLSID_A )

object objDisp = Activator.Creat eInstance( comType );

TcpChannel chnl = new TcpChannel( 8086 );

ChannelServices .RegisterChanne l( chnl );

//Through Reflection now we call a method on this IA which returns

Dispatch of IB ( in C# we get this as System.__ComObj ect )

Now we're creating a CAO for our component CSA and call the method

which expects as parameter the System.__ComObj ect Created earlier

RemotingConfigu ration.Register ActivatedClient Type( typeof( CSA ),

"tcp://8085" );

CSA objCSA = new CSA.CSA();

objCSA.getSomet hing( objDisp );



C# Assembly

Component CSA

protected object m_objSess;

CSA::getSomethi ng( objDisp )

{

m_objSess = objDisp;

//Now using reflection we call a method of this

System.__ComObj ect passed as parameter
}



C# Server

BinaryServerFor matterSinkProvi der prov = new

BinaryServerFor matterSinkProvi der();

prov.TypeFilter Level = TypeFilterLevel .Full;
IDictionary prop = new HashTable();
prop["port"] = 8085;

TcpChannel chnl = new TcpChannel( prop, null, prov );

ChannelServices .RegisterChanne l( chnl );

RemotingConfigu ration.Register ActivatedServic eType( typeof( CSA ) );

System.Console. Readline();


Now on executing the code ,at line marked in red it throws an

exception telling that "System.Runtime .Remoting.Remot ingException: 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 createObjRefMon iker )

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

Regards.

"enrico sabbadin @ infinito" <sabbadin@infin ito_xyz.it> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
drop
ChannelServices .RegisterChanne l (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.co m> wrote in message
news:#Y******** ******@TK2MSFTN GP10.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.__ComObj ect 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.GetTypeFro mCLSID( CLSID_A )

object objDisp = Activator.Creat eInstance( comType );

TcpChannel chnl = new TcpChannel( 8086 );

ChannelServices .RegisterChanne l( chnl );

//Through Reflection now we call a method on this IA which returns

Dispatch of IB ( in C# we get this as System.__ComObj ect )

Now we're creating a CAO for our component CSA and call the method

which expects as parameter the System.__ComObj ect Created earlier

RemotingConfigu ration.Register ActivatedClient Type( typeof( CSA ),

"tcp://8085" );

CSA objCSA = new CSA.CSA();

objCSA.getSomet hing( objDisp );



C# Assembly

Component CSA

protected object m_objSess;

CSA::getSomethi ng( objDisp )

{

m_objSess = objDisp;

//Now using reflection we call a method of this

System.__ComObj ect passed as parameter
}



C# Server

BinaryServerFor matterSinkProvi der prov = new

BinaryServerFor matterSinkProvi der();

prov.TypeFilter Level = TypeFilterLevel .Full;
IDictionary prop = new HashTable();
prop["port"] = 8085;

TcpChannel chnl = new TcpChannel( prop, null, prov );

ChannelServices .RegisterChanne l( chnl );

RemotingConfigu ration.Register ActivatedServic eType( typeof( CSA ) );

System.Console. Readline();


Now on executing the code ,at line marked in red it throws an

exception telling that "System.Runtime .Remoting.Remot ingException: 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 createObjRefMon iker , will you elaborate on this option ?
"Catherine Jones" <no*@moreply.co m> wrote in message
news:ez******** ******@TK2MSFTN GP12.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 createObjRefMon iker )

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

Regards.

"enrico sabbadin @ infinito" <sabbadin@infin ito_xyz.it> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
drop
ChannelServices .RegisterChanne l (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.co m> wrote in message
news:#Y******** ******@TK2MSFTN GP10.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.__ComObj ect 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.GetTypeFro mCLSID( CLSID_A )

object objDisp = Activator.Creat eInstance( comType );

TcpChannel chnl = new TcpChannel( 8086 );

ChannelServices .RegisterChanne l( chnl );

//Through Reflection now we call a method on this IA which returns

Dispatch of IB ( in C# we get this as System.__ComObj ect )

Now we're creating a CAO for our component CSA and call the method

which expects as parameter the System.__ComObj ect Created earlier

RemotingConfigu ration.Register ActivatedClient Type( typeof( CSA ),

"tcp://8085" );

CSA objCSA = new CSA.CSA();

objCSA.getSomet hing( objDisp );



C# Assembly

Component CSA

protected object m_objSess;

CSA::getSomethi ng( objDisp )

{

m_objSess = objDisp;

//Now using reflection we call a method of this

System.__ComObj ect passed as parameter
}



C# Server

BinaryServerFor matterSinkProvi der prov = new

BinaryServerFor matterSinkProvi der();

prov.TypeFilter Level = TypeFilterLevel .Full;
IDictionary prop = new HashTable();
prop["port"] = 8085;

TcpChannel chnl = new TcpChannel( prop, null, prov );

ChannelServices .RegisterChanne l( chnl );

RemotingConfigu ration.Register ActivatedServic eType( typeof( CSA ) );

System.Console. Readline();


Now on executing the code ,at line marked in red it throws an

exception telling that "System.Runtime .Remoting.Remot ingException: 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.

createObjRefMon iker :

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@infin ito_xyz.it> wrote in message news:%2******** **********@tk2m sftngp13.phx.gb l...
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 createObjRefMon iker , will you elaborate on this option ?


"Catherine Jones" <no*@moreply.co m> wrote in message
news:ez******** ******@TK2MSFTN GP12.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 createObjRefMon iker )

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

Regards.

"enrico sabbadin @ infinito" <sabbadin@infin ito_xyz.it> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
drop
ChannelServices .RegisterChanne l (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.co m> wrote in message
news:#Y******** ******@TK2MSFTN GP10.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.__ComObj ect 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.GetTypeFro mCLSID( CLSID_A )
>
> object objDisp = Activator.Creat eInstance( comType );
>
> TcpChannel chnl = new TcpChannel( 8086 );
>
> ChannelServices .RegisterChanne l( chnl );
>
> //Through Reflection now we call a method on this IA which returns
>
> Dispatch of IB ( in C# we get this as System.__ComObj ect )
>
> Now we're creating a CAO for our component CSA and call the method
>
> which expects as parameter the System.__ComObj ect Created earlier
>
> RemotingConfigu ration.Register ActivatedClient Type( typeof( CSA ),
>
> "tcp://8085" );
>
> CSA objCSA = new CSA.CSA();
>
> objCSA.getSomet hing( objDisp );
>
>
>
>
>
>
>
>
>
> C# Assembly
>
> Component CSA
>
>
>
>
>
> protected object m_objSess;
>
> CSA::getSomethi ng( objDisp )
>
> {
>
> m_objSess = objDisp;
>
> //Now using reflection we call a method of this
>
> System.__ComObj ect passed as parameter
>
>
> }
>
>
>
>
>
>
>
> C# Server
>
> BinaryServerFor matterSinkProvi der prov = new
>
> BinaryServerFor matterSinkProvi der();
>
> prov.TypeFilter Level = TypeFilterLevel .Full;
>
>
> IDictionary prop = new HashTable();
>
>
> prop["port"] = 8085;
>
> TcpChannel chnl = new TcpChannel( prop, null, prov );
>
> ChannelServices .RegisterChanne l( chnl );
>
> RemotingConfigu ration.Register ActivatedServic eType( typeof( CSA ) );
>
>
>
> System.Console. Readline();
>
>
>
>
>
>
> Now on executing the code ,at line marked in red it throws an
>
> exception telling that "System.Runtime .Remoting.Remot ingException:

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 createObjRefMon iker.

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.Remoti ngException: 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 .RegisterChanne l (new TcpChannel(0));
on the client side ?
"Catherine Jones" <no*@moreply.co m> wrote in message
news:u3******** *****@tk2msftng p13.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.

createObjRefMon iker :

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@infin ito_xyz.it> wrote in message
news:%2******** **********@tk2m sftngp13.phx.gb l...
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 createObjRefMon iker , will you elaborate on this option ?
"Catherine Jones" <no*@moreply.co m> wrote in message
news:ez******** ******@TK2MSFTN GP12.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 createObjRefMon iker )

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

Regards.

"enrico sabbadin @ infinito" <sabbadin@infin ito_xyz.it> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
drop
ChannelServices .RegisterChanne l (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.co m> wrote in message
news:#Y******** ******@TK2MSFTN GP10.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.__ComObj ect 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.GetTypeFro mCLSID( CLSID_A )
>
> object objDisp = Activator.Creat eInstance( comType );
>
> TcpChannel chnl = new TcpChannel( 8086 );
>
> ChannelServices .RegisterChanne l( chnl );
>
> //Through Reflection now we call a method on this IA which returns
>
> Dispatch of IB ( in C# we get this as System.__ComObj ect )
>
> Now we're creating a CAO for our component CSA and call the method
>
> which expects as parameter the System.__ComObj ect Created earlier
>
> RemotingConfigu ration.Register ActivatedClient Type( typeof( CSA ),
>
> "tcp://8085" );
>
> CSA objCSA = new CSA.CSA();
>
> objCSA.getSomet hing( objDisp );
>
>
>
>
>
>
>
>
>
> C# Assembly
>
> Component CSA
>
>
>
>
>
> protected object m_objSess;
>
> CSA::getSomethi ng( objDisp )
>
> {
>
> m_objSess = objDisp;
>
> //Now using reflection we call a method of this
>
> System.__ComObj ect passed as parameter
>
>
> }
>
>
>
>
>
>
>
> C# Server
>
> BinaryServerFor matterSinkProvi der prov = new
>
> BinaryServerFor matterSinkProvi der();
>
> prov.TypeFilter Level = TypeFilterLevel .Full;
>
>
> IDictionary prop = new HashTable();
>
>
> prop["port"] = 8085;
>
> TcpChannel chnl = new TcpChannel( prop, null, prov );
>
> ChannelServices .RegisterChanne l( chnl );
>
> RemotingConfigu ration.Register ActivatedServic eType( typeof( CSA ) );
>
>
>
> System.Console. Readline();
>
>
>
>
>
>
> Now on executing the code ,at line marked in red it throws an
>
> exception telling that "System.Runtime .Remoting.Remot ingException:

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
4753
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 and is defined in an assembly common to the client and server components. The custom class merely defines three (3) constructors -- the null constructor; one with a string parameter; and one with a string and innner exception parameter -- that...
4
2743
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 also supported per the SOAP Spec, and from what I understand, .NET's implementation of WebServices, donot follow the standard, but instead shimmy this behavior by working with a strict request/response WSDL. So my question is - If I mark an int...
9
3795
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 techniques are not feasible) The question is; Given that I have a Person object with a private set for id. What is the recommended approac in passing that object to the web service
1
1527
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 it is considered a reference to the object. C# call: i = some_method( some_object ); C++ method:
2
1321
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 it is considered a reference to the object. C# call: i = some_method( some_object );
3
1937
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 ServiceController("ProsetLogServices") sc.MachineName = "." If sc.Status = ServiceControllerStatus.Stopped Then sc.Start() End If
7
10147
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()_ Public Sub MyMethod(ByVal arg As MyComplexClass) End Sub
3
5564
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 error regarding "the proxy has no channel sink.......or no suitable Client channel to talk to the server."
3
1568
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 a object (as opposed to a value type like Integer, Boolean, etc) is passed as a ByVal parameter, it's content can be modified. This is somehow "strange", but I've lived with that so far.
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9266
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6054
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4826
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3280
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.