.NET Remoting (GetObejct vs. RemotingConfiguration.Configure)

kalliopi
kalliopi used Ask the Experts™
on
I have a strange situation.  I have a client app, where this line works correctly:
MyRemoteObj liason = (MyRemoteObj)Activator.GetObject(typeof(MyRemoteObj), 
"tcp://localhost:2396/MyRemoteObj");

Open in new window

But after doing this:
 
 RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyRemoteObj),    
"tcp:`//localhost:2396/MyRemoteObj", WellKnownObjectMode.Singleton);

Open in new window

or this:
 
  String path = String.Format("{0}.config", Application.ExecutablePath);    
RemotingConfiguration.Configure(path, false);

Open in new window

I am UNABLE to use
MyRemoteObject liason = new MyRemoteObject();

Open in new window

It simply instantiates a new local object.  What am I missing?
My App config includes this:
  <system.runtime.remoting>
    <application>
      <client>
        <wdellknown type="Testing.MyRemoteObject, Testing" url="tcp://localhost:2396/MyRemoteObj"/>
      </client>
    </application>
  </system.runtime.remoting>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Anuradha GoliSystems Development / Support Specialist
Commented:
Most Valuable Expert 2012
Top Expert 2014
Commented:
Do you register the channel anywhere?

http://msdn.microsoft.com/en-us/library/czshbka7.aspx

Author

Commented:
anuradhay - Thanks for the link.  The problem here is not a lack of understanding of how .NET remoting works.  I understand the concepts.  I have done remoting successfully in the past (using the same process).

The issue I'm trying to resolve is the SPECIFIC situation of .GetObject working (which tells me that the server side is configured correctly) but the NEW keyword NOT working.  On another remoting app which works, once I call the .Configure(...) method - any well known types registered there are created as CAO objects.  For some reason, that's not happening in this app - and I don't get why.

Specifically - what might prevent my app from registering/handling well known types correctly?

Author

Commented:
CodeCruiser - thanks for the suggestion.  In answer to your question, no, I'm not explicitly registering a channel.  That being said, what I don't get is that I'm doing remoting in another app, and don't need (on the client side) anything more than I have in this original post.  I put the "WellKnown" keyword in the app.config.  Call RemotingConfiguration.Configure(...) and then when I new up that type, it does so using remoting - just as expected.  For some reason, I can't get it working in this app and I'm trying to figure out why.  
Any suggestions appreciated.

Author

Commented:
Sorry - I just answered both questions myself.  I needed to be using this:            

RemotingConfiguration.RegisterWellKnownClientType

Rather than RegisterWellKnownServiceType.  Also, it appears I just had a typo in my client app.config, since <wdellknown> is not the appropriate keyword.  Changing the RegisterWellKnownType fixed the problem with that method.  Fixing the tag fixed the problem using the RemotingConfiguration.Configure.

Thanks for the help guys!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial