am developing an MTS based system using dll's developed using ATL.
Some of the methods must make calls to an out of process free threaded Com
exe ( implemented as a NT Service) . These methods currently create an instance
of the out of process object make a call on it and then release the instance
. This is proving to be very expensive.
As a performance improvement I would like to be able to create the instance
of the out of process object once and store it in an MTS shared property
and then retrieve it when required. To this end i have modified the out of
process object to create an instance of itself when the nt servive is starting
and then store this in a static variable, i have added a new method to
the out of process object which retrieves this object instance.
I have developed a routine used by the MTS dll which checks for the existance
of a shared property if not there it sets it up and populates it with the
instance of the out of process object ( retrieved via the previously mentioned
method call) , if there it just gets the object instance stored in the shared
prop.
This works fine for the first call but the 2nd call which results in using
the instance stored in the shared prop returns a hr of 0x8001010e RPC_E_WRONG_THREAD
when i make the method call on the object instance.
Any ideas what i am doing wrong or is there a better way of improving my
performance in this scenario.