1

I've got two services running in the same process, hosting the same classes, on different IP-ports.

The instantiated classes are expected to work against different databases depending on what port was called.

Is it possoble to get some 'owner' information in the constructor of my classes that are MarshalByRefObjects?

A reference to the Service, TcpCannel or some arbitrary values. Anything will do, I'm desperate.

Clarification (I hope): In my Main() I have

ServicesToRun = new ServiceBase[] { 
new BatchServer("ServerA"),
new BatchServer("ServerB")};

and in ExecuteService() in my ServiceBase implementation I have:

RemotingConfiguration.RegisterWellKnownServiceType(
   typeof(RmtObject), "RmtObject",
   WellKnownObjectMode.Singleton);

on the client side I create the object like this:

(RmtObject)Activator.GetObject(typeof(RmtObject), theURI, WellKnownObjectMode.Singleton);

When a method i executed on RmtObject I need to know, within RmtObject, if it belongs to ServerA or ServerB.

I could use WellKnownObjectMode.SingleCall instead if it makes things easier.

idstam
  • 2,848
  • 1
  • 21
  • 30
  • Can you clarify your question? I don't really understand the problem. – leppie Jan 20 '12 at 12:10
  • 1
    Did you try this? http://stackoverflow.com/questions/527676/identifying-the-client-during-a-net-remoting-invocation – chandmk Jan 22 '12 at 12:18
  • Thanks @user6130. Implementing my own SinkProvider solved it. Sorry I can't flag a comment as an answer. – idstam Jan 25 '12 at 08:03

1 Answers1

0

I solved this by implementing my own SinkProvider much like the most up voted answer here: Identifying the client during a .NET remoting invocation.

Community
  • 1
  • 1
idstam
  • 2,848
  • 1
  • 21
  • 30