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.
I solved this by implementing my own SinkProvider much like the most up voted answer here: Identifying the client during a .NET remoting invocation.