Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Remoting / January 2004

Tip: Looking for answers? Try searching our database.

No Need to Explicitly Register Client Channels?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve G - 12 Jan 2004 16:05 GMT
I'm reposting a previous post here with a more descriptive subject,
which will hopefully get a bit more attention.

My issue is this:
I am calling a remote object over TCP from a pooled .NET Serviced
Component (COM+ component). Because this component (which will be the
Remoting client) is really a stateless component (and there could be
several of the component in the application pool), I am questioning
the best place to register and unregister the client tcp channel.  I
assume I should either create or register a single channel that is
static to the component, or I should register and unregister the
channel explicitly ever time I need to call the remote object.

HOWEVER, I noticed in my test code that I was able to completely
remove the explicit channel registration, and everything still seemed
to work fine!  Can anyone explain this?  I am using
Activator.GetObject() to create the proxy for my remote object, as so:

MyObject myObj = (MyObject)Activator.GetObject(
 typeof(MyObject), "tcp://server:port/ObjectName");
myObj.MyMethod();

Perhaps (as Sunny suggested in my previous post) channel registration
is only required when using events/delegates?  Strangely, I have yet
to see an example where someone doesn't explicitly register a channel
on the client.  I wonder if the Activator.GetObject() method is
actually creating and registering a default channel for me?  It would
be nice not to have to worry about explicitly registering and
unregistering channels if I don't need to, but at the same time, I
don't want to deploy this code that seems to magically work (despite
what I have been reading) and have it not work all the sudden when it
is deployed in a production environment.

Any info is appreciated.

Steve
al - 14 Jan 2004 12:42 GMT
I need to double check this in one of my text books, but I
think that as you are calling a Serviced Component, and it
is probably appearing as a library in your Compenent
Services MMC, it will be using COM/DCOM for the
communication. If the client is on the same machine as the
component, then DCOM spots this and uses shared memory.

When I have tried to deploy this to a distributed
enviroment, installing the COM+ application proxy on the
client, I'm getting a security exception.

I hope this helps you, and I'd like to know how you get on
in a distributed enviroment, as I'm not making much
progess at the moment
Steve G - 20 Jan 2004 21:16 GMT
I have tested the above in a distributed environment as well, and it
worked fine.

Just as a side note for anyone reading this in the future - I was
actually able to find the behavior I describe (i.e. not having to
explicitly register a client channel) documented in the .NET Framework
SDK documentation under Programming with the .NET Framework ->
Accessing Objects in Other Application Domains Using .NET Remoting.  I
feel better now knowing that this is expected and intended behaviour.

Apparently, if you do not explicity register a client channel, the
Framework will attempt to register one for you from the list of
supported channels in your machine.config file.

Steve

> I need to double check this in one of my text books, but I
> think that as you are calling a Serviced Component, and it
[quoted text clipped - 10 lines]
> in a distributed enviroment, as I'm not making much
> progess at the moment
Sunny - 21 Jan 2004 17:20 GMT
Hi Steve,
I have found in the article Channels under the path you point, that:
<cite>
Clients can communicate with a remote object using any registered
channel. The remoting system ensures that the remote object is connected
to the right channel when a client attempts to connect to the object.
The client is responsible for calling ChannelServices.RegisterChannel
before attempting to communicate with a remote object. If it expects a
callback function, the client must register a channel and a port.
</cite>

Is this what you mean. If yes, it just confirms mine statement in the
other post - thank you for pointing me there.
If no, where to look for additional info?

Thanks
Sunny

> I have tested the above in a distributed environment as well, and it
> worked fine.
[quoted text clipped - 26 lines]
> > in a distributed enviroment, as I'm not making much
> > progess at the moment

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.