Single Threading a Web Service

Discussion in 'ASP .Net Web Services' started by Gregory_May, Apr 19, 2006.

  1. Gregory_May

    Gregory_May Guest

    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
     
    Gregory_May, Apr 19, 2006
    #1
    1. Advertising

  2. Gregory_May

    Josh Twist Guest

    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/
     
    Josh Twist, Apr 20, 2006
    #2
    1. Advertising

  3. Gregory_May

    Gregory_May Guest

    Thanks!

    Its a 3rd party dll for talking to a piece of hardware.


    "Josh Twist" <> wrote in message
    news:...
    > 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/
    >
     
    Gregory_May, Apr 20, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    9
    Views:
    1,075
    Mark Space
    Dec 29, 2007
  2. Steven Woody
    Replies:
    0
    Views:
    441
    Steven Woody
    Jan 9, 2009
  3. Steven Woody
    Replies:
    0
    Views:
    463
    Steven Woody
    Jan 9, 2009
  4. Scott Baierl
    Replies:
    1
    Views:
    290
    Scott Baierl
    Jul 29, 2006
  5. Leo Violette
    Replies:
    0
    Views:
    1,068
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page