Question

I have implemented a simple HTTP Server using HTTPListener , I need to launch a process that runs for about 10 minutes from HTTPListerner . When a request is made from user , I dont want user to wait in browser untill the process completes as its going to timeout . So I launch process and just return a status . How can I launch the process ?

Was it helpful?

OTHER TIPS

In my opinion you should:

  1. Receive the request and assign a unique ID to it
  2. Launch the process
  3. Send back the unique ID to the user
  4. Allow the user to get back the status of your processing using your ID

It's your choice (it depends on your app) if these IDs are stored in memory or on a file/database.

Consider, as an addition, that if this simple HTTP Server is hosted on IIS, that IIS has the opportunity to kill your process as soon as is necessary, so it's not a good idea to start long running processes.

You should take the request with your HTTP server, but then start the process from a backend service.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top