Re: Web Service as a background service
- From: "John Saunders" <no@xxxxxxxxxxxxxxxx>
- Date: Thu, 9 Oct 2008 19:58:41 -0400
"Jason Barnett" <JasonBarnett@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:B116B1DA-6BF3-43A1-8376-59B0C7267082@xxxxxxxxxxxxxxxx
I'm trying to create a Web Service that acts like a Windows Service. It
contains Start, Stop, and GetStatus methods. Invoking the Start method of
the web service should kick off a timer and the Stop method stops the timer.
I've been able to accomplish all by placing the timer in the Application
object (to persist its state). However, the timer doesn't fire since the web
method has finished executing (and the asmx file is unloaded?).
I've tried creating a seperate thread in hopes that the worker thread would
function after the web method finishes execution, but apparently that didn't
work. I suspect I would need to create a seperate process that runs in the
background, but I hope there's another way.
Could someone give some direction on a quick and easy approach, if one exists?
Yes. Use a Windows Service. Web Services aren't for this purpose, and it's not going to work.
Windows Services are trivial to create. Why not use them, since that's what they're for. If you need the service to be triggered based on a client calling the web service, then have the web service send a message to the Windows Service.
--
John Saunders | MVP - Connected System Developer
.
- References:
- Web Service as a background service
- From: Jason Barnett
- Web Service as a background service
- Prev by Date: RE: Web Service as a background service
- Next by Date: RE: WCF Proxy Server settings not working
- Previous by thread: RE: Web Service as a background service
- Next by thread: ASP .NET 2.0 web service beginner question - Multiple classes
- Index(es):
Relevant Pages
|
Loading