Hi Philippe ,
For your scenario, since you're calling an out-of-process COM object, it
will launch new COM process for new created object. To avoid this, I agree
with Munna that you can use a global variable(such as a static class
member) to cache a single instance of the COM component instance(something
like a singleton wrapper class) and all your webservice methods will use
that one. There is several things you need to take care here:
1. The COM component might not be thread safe, so for such multi-threading
environment, you will need to lock it when accessing it in each thread.
2. If #1 will make your performance impacted, consider creating multiple
such global instances as a pool so that you can always reuse these pooled
instances.
3. for .NET webservice/web application environment, the thread is MTA
thread while most COM objects are STA, this will make an additional calling
gap between them. If the COM is really an STA one, you may need to adjust
your webservice thread's COM apartment model, see the following article:
#Running ASMX Web Services on STA Threads
http://msdn.microsoft.com/en-us/magazine/cc163544.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------