Rick
Thu Sep 09 01:23:39 CDT 2004
Rajesh,
If you have control over the thread that the COM object runs on create that
thread with ApartmentState to STA. This should allow the COM object to work
properly and create individual instances on separaet threads.
This is likely the only way you will get this to work - STA style COM
objects will get corrupted if called from a free threaded environment if
more than one thread accesses this object. STA will make sure that the COM
object always gets marshalled to the thread that created it.
+++ Rick ---
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
http://www.west-wind.com/wwThreads/
----------------------------------
Making waves on the Web
"rajesh.sivakumar" <rajesh.sivakumar@hotmail.com> wrote in message
news:OWca6NjlEHA.3476@tk2msftngp13.phx.gbl...
> I am using a third party COM componenet which is not thread safe in a .Net
> web application using Interop. When two threads (two requests) are trying
to
> access the componenet it is giving an error and crashing. It works fine if
> the request is made only one at a time. How can I code around this problem
> so that only one thread operates on the COM object at one time.
>
> Any help will be greatly appreciated.
>
> Thanks
> Rajesh
>
>