Problem with the Web service using the COM object

advertisements

I have a VB.NET web service that is calling a Interop COM object. When I make multiple calls to the web service at the same time, the web service processes fine until it gets to calling the first method of the COM object. At this point, it seems as though the calls to the COM object get put on a stack and they get processed on a FIFO basis. So, each web service call sits until the previous one has completed processing.

I have done the same thing on the console app side before with calling a class library that is using the COM library and you could run multiple console apps using the same Interop COM object at the same time with no problem.

What do I need to do in order to get this to work properly on the web services side? The web services should not have to wait for a COM to finish in a previous web service call in order to continue processing.


Your multiple console instances are each their own process so they get their own copy of the COM object.

IIS and your web service are in a single process so you will be subject to the COM threading rules. It may be that the COM object you are using is marked single threaded. Or it implements a singleton pattern so that only one copy exists per process and it is apt threaded. Regardless for an apt threaded COM object only one thread can be accessing it at a time.

The rules around COM and threading are fairly complex, they COM object you are using may not have been written to work well under IIS.