Reputation: 106980
I've got a .NET application which uses a COM server. The COM server is registered on the machine where I run it, so when my code reaches new MyInterop.SomeObject()
the appropriate MyComServer.exe
is started.
However, as I'm debugging, I've got several copies of MyComServer.exe
residing in different folders with different configuration files. I would like to specify which my app should load.
Two workarounds that I know of are:
MyComServer.exe /regserver
) before use. But I don't like to use a global solution for a local problem.MyComServer.exe
manually (it then runs as a standalone app) and the COM infrastructure will reuse this existing process. But that's not very automatable.Is there anything more appropriate?
Upvotes: 1
Views: 131
Reputation: 942119
The COM server .exe got started by your new MyInterop.SomeObject() call. You've no doubt got so many .exe's running because you terminated the program while debugging, without allowing .NET to shutdown properly and decrease the reference count in the finalizer thread. COM doesn't have a mechanism to clean-up these lost references. Simply use Taskmgr.exe, Process tab to kill the running instances.
COM has a mechanism to attach to a running instance of a server through the ROT (Running Object Table). This is however not something you can bolt on later, it has to be explicitly supported by the server. If you do have to option to tinker with the server then do consider making it an in-process server instead. Much less troublesome.
Upvotes: 1
Reputation: 579
You could try creating the config file dynamically based on debug version.
Upvotes: 0