The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by pupczak]

Hi,
I'm a .NET newbie/novice for sure, and I'm having a problem on my system
making a client proxy connection to a remote object under the example code in
chapter 5 (listings 5.1, 5.2) of Microsoft .NET for Programmers (a wonderful
book, I must add!)
-- what is happeing is that the server side is running just fine saying it has
registered the HelloObj class/object and is waiting for calls. My client
however throws an exeption on the call
HelloObj remObjRef = (HelloObj)
Activator.GetObject(typeof(HelloObj),
"tcp://localhost:6789/HelloObj");
So I trapped it. Exception::Message says:
"Trying to create a proxy to an unbound type." and I can't find any
information about what that really means in either local .NET help, or MSDN
online, or MSKB articles. I've looked at the resolved type from typeof() and
it says "HelloObj" when stringized; I've looked at netstat and found
TCP <hostname>:6789 <hostname>:0 LISTENING
so that seems good. 'localhost' is certainly good as I can ping it and it
responds with proper loopback IP, and all http://localhost/... connections I
use work just fine.

Hopefully, someone out here might have seen & solved this? Is it a .NET
problem or something in system/network layers?

thanks for any help,
regards,
-PeteU.
import-bot (20211) [Avatar] Offline
#2
Re: remoting troubles
[Originally posted by peteu]

Hey all,
This is a followup as an "FYI" in case you ever encounter this problem.
I must (sheepishly) admit pilot error, but there's better lessons learned:

(the "duh" factor): Because of prior experimentation (I don't alway code right
to the letter of the given examples) I had forgotten to inherit from
MarshalByRefObject in my HelloObj remote object. But that's only one aspect of
it.

(extending that mistake...): Other toying around shows that it is critical to
make sure you have the right reference / serializable inheritance of your
remote object according to the value vs. reference rules of your underlying
remote type, or exceptions similar to the one I previously stated are thrown.
There is little reference material available on underlying causes of
exceptions in MSDN, at least for this specific remoting method.
I would have expected the compilation phase to understand the
incompatibilities for some types of mismatches and/or access attempts, but
apparently it does not (perhaps there is no way to know until runtime).

regards.