Solved

MTS and Global MultiUse

Posted on 2001-08-12
4
386 Views
Last Modified: 2006-11-17
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!!!)




0
Comment
Question by:misterben
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 6378938
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
 
LVL 6

Accepted Solution

by:
anthony_glenwright earned 75 total points
ID: 6379456
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
 

Author Comment

by:misterben
ID: 6379471
Thanks Anthony for the quick response.

0
 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6379482
No problem.  Good luck.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question