user1306787
user1306787

Reputation: 151

Generating a file in the background based on user request

I have a C# web application (MVC1, .NET 3.5) with a function to generate reports. I was wondering if anyone has suggestions for how to implement the following scenario:

  1. Logged in user clicks on the report button and goes on to browse other parts of the website OR simply logs off
  2. Once the report is finished generating, it is e-mailed to the user

Main question being - how can I start a separate thread on the server that will accomplish this? If multithreading is not the way to go, please feel free to make other suggestions. Typical time to generate a report can be upwards of 10 minutes. Also, this functionality will rarely be used by more than one user at a time so I am imagining something along the route of "queueing up" a function and letting it execute in the background.

Thanks for all your help!

Upvotes: 4

Views: 151

Answers (2)

Baz1nga
Baz1nga

Reputation: 15579

Have you looked at utilizing Microsoft Windows HPC Server 2008.. It fits your use case perfectly or you can stick to the routine and write a windows service that does this for you. But if you can afford it I would recommend jumping on the HPC bandwagon..

You can start reading about it here

Upvotes: -1

Erik Philips
Erik Philips

Reputation: 54638

I suggest creating a Windows Service that polls the database for reports to generate, generates them and emails them. The specifics of the report are entered by the user on the website and the website simply stores that information in a database.

Upvotes: 4

Related Questions