I have an asp.net (mvc) web site. As the part of the functions I will have to support some long running operations, for example:
Initiated from user: User can upload (xml) file to the server. On the server I need to extract file, do some manipulation (insert into the db) etc... This can take from one minute to ten minutes (or even more - depends on file size). Of course I don't want to block the request when the import is running , but I want to redirect user to some progress page where he will have a chance to watch the status, errors or even cancel the import.
This operation will not be frequently used, but it may happen that two users at the same time will try to import the data. It would be nice to run the imports in parallel. At the beginning I was thinking to create a new thread in the iis (controller action) and run the import in a new thread. But I am not sure if this is a good idea (to create working threads on a web server). Should I use windows services or any other approach?
Initiated from system: - I will have to periodically update lucene index with the new data. - I will have to send mass emails (in the future).
Should I implement this as a job in the site and run the job via Quartz.net or should I also create a windows service or something?
What are the best practices when it comes to running site "jobs"?
Thanks!