Single Threading a Web Service

G

Gregory_May

I am writing a web service to talk to a single threaded Com Componant. Is
there a simple way to single thread my Web Service so the Com Object doesnt
get confused?

Below is a stab:

<WebMethod()> _
Public Function MyWebService(ByVal MyParm As string)
Static Dim SyncObject As New Object
SyncLock (SyncObject)

SillySingleThreadedCOMObject.Method(MyParm)

End SyncLock

End Function
 
J

Josh Twist

That should work within an appdomain. If you want to synchronise access
to the COM object across the whole machine you'll need to use a mutex.

Why is the COM single threaded - is it a VB6 component running in an
STA? If so, you can usually just add the component to COM+ and you'll
get access to a lot more threads from the COM+ STA threadpool.

Josh
http://www.thejoyofcode.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top