tags:

views:

47

answers:

2

I have a web service app, I have 1 web service call that could take anything from 1 hour to 14 hours, depending on the data that needs to be processed and the time of the month.

Is there any way to create a job in IIS that could be capable of running this extended process. I also need job management and reporting to be able to see if jobs are running, so that new jobs aren't created on top of others.

I will be working with IIS6 primarily. And would like to use C# code.

Right now I am using a web service call, but I don't like the idea of having web services run for such a long time, and due to the nature of the web service, I can't split the functionality any more.

IIS jobs would be awesome if they are available. Any ideas?

+2  A: 

If I were you, I would make a command line app that is kicked off by the web service. Running a commandline app is pretty straight forward, basically

 Process p = new Process();

 p.StartInfo.UseShellExecute = false;
 p.StartInfo.FileName = "appname.exe";
 p.Start();

There are a limited amount of worker processes per machine, they aren't really meant for long running jobs.

Matt Briggs
That might be an excellent solution, combined with a mutex, to ensure only 1 running version...
JL
A: 

One possibility, with a bit of setup cost, is to have your processing run as a Windows service that listens to a message queue (MSMQ or similar), and have your web service simply post the request onto the message queue to be handled by the processing service.

Monitoring jobs is more difficult; your web service would need to have a way of querying your processing service to find out its state. This is an IPC (interprocess communication) problem, which has many different solutions with various tradeoffs that depend on your environment and circumstances.

That said, for simple cases, Matt's solution is probably sufficient.

Jeff Hardy