Avatar of kalliopi
kalliopi
 asked on

.NET Remoting (GetObejct vs. RemotingConfiguration.Configure)

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

C#.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
kalliopi

8/22/2022 - Mon
SOLUTION
Anuradha Goli

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Nasir Razzaq

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
kalliopi

ASKER
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?
kalliopi

ASKER
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.
kalliopi

ASKER
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!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck