MTS and Global MultiUse

I have a nice errorhandler component which manages the error call stack. ie. When an error occurs, all error handlers use this component to return a nice new error description which is passed on thru the stack.

I'd like to make the component GlobalMultiUse so developers don't have to worry (or forget) about instantiating this component.

If I have a component designed to run under MTS, can I safely reference my new globalmultiuse error component.  

I have tried this and get a windows error when the MTS component times out.

Are there any tricks to this..?

(Sorry about the points, its all I have!!!)




misterbenAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
anthony_glenwrightConnect With a Mentor Commented:
I had a global multiuse function (an error handler, just like you), and when we introduced MTS support, I just couldn't get it to work...

Eventually, I found this article, http://support.microsoft.com/support/kb/articles/Q241/8/96.ASP which contains "Do not use the GlobalMultiUse Instancing property for a class when you intend to use the ActiveX component under MTS or COM+. The interface for the GlobalMultiUse object is cached in a per thread-based table and is not freed until the thread terminates. As a result, if a call comes in with a different context (although on the same thread), it fails with RPC_E_WRONG_THREAD. To use components in MTS and COM+, you should design your classes in such a way that the objects are stateless. "
0
 
CJ_SCommented:
MTS takes care of creating and eliminating the component whenever it feels like. For example when the MTS machine runs out of memory, or when it hasn't been used for some time. That is the amin difference if you are using MTS, without MTS the component will run in-process and thus won't be destroyed until you request it to be destroyed.

You can try checking out the Activation tab in the properties of the components in MTS (I am using component services from windows 2000 so it might be named differently for you...)

regards,
CJ
0
 
misterbenAuthor Commented:
Thanks Anthony for the quick response.

0
 
anthony_glenwrightCommented:
No problem.  Good luck.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.