Search code examples
c#.net-assembly.net-remotingassembly-loading

Could app process #1 get direct reference to public static objects in app process #2 on same machine (running as service)?


I have a .NET application that can either run as a console app, or as a Windows service (depending on startup parameters).

The idea here is to have an instance running as a console app to act as a UI for another instance that is running as a service on the same machine. In other words, instance #1 can examine and control the state of instance #2. Both instances are run from the same physical files - there is only one installation of the application.

I need to accomplish this with minimal changes to app, e.g. without creating a WCF services layer (there are a LOT of methods that need to be accessed), so I was wondering if it was possible for the console app to obtain direct code-to-code references to public static objects in the service app.

The public static objects I want access to are in the EXE itself, but could be moved into an assembly loaded by the app if needed.

It sounds like .NET Remoting might be a solution, except for the fact it is discontinued. Is there another possibility?


Solution

  • It looks like the answer is NO - this cannot be done.