views:

308

answers:

1

Hello

I have a COM object which I need to access from my .NET Web Service.

I know of the whole STA/MTA thing - so my COM object would be converted to be MTA and have no global state (while not being multi-threaded itself).

If I set this up as a COM+ server, and specify an object pool, does this mean that for each web service thread it will use a different instance of the COM object? And not queue?

Thanks

+2  A: 

It depends on several things.

If you put an upper limit on the number of objects in the pool, and you keep the object reference alive in the web service client, and you don't use JIT or don't set the Done flag in your method call, they will queue once they hit the pool limit.

If you do use JIT and set the Done flag by calling SetComplete or using the AutoComplete attribute on the method, the COM+ component will be deactivated and put back in the pool when the method returns. Unless the number of concurrently executing methods reaches the max pool limit, new method calls will never need to wait.

Carlos A. Ibarra
I wouldn't be keeping the COM object alive or anything, it would be a simple 'fire-and-forget' type of call. I just need to ask the COM object for Something, and once I've got that then I can close the connection to it. When you say AutoComplete attribute - is this on the .NET side?
Duncan
No, [AutoComplete(true)] goes on the COM+ side. You can disconnect from COM+ and that will also cause deactivation, but if you want speed, keep the connection to the COM+ object alive and keep calling its methods.
Carlos A. Ibarra
Okay, thing is each web service thread is going to just call the COM+ object ONCE each time. From your experience, is performance going to suck? Is there a considerable overhead when calling COM+ from .NET?
Duncan
If you create the COM+ client object each time, it will have to make a connection to the COM+ server which involves some latency, especially across the network. If they are on the same machine it may not be too bad. Also, it is simpler to program and you don't have to worry about reconnecting if the server goes down. Try it and see. If it is way too slow you can always do it the other way later.
Carlos A. Ibarra