I have an asp.net project with is created using layered architecture (Presentation, Business and Data Access layer). Now I need to add a windows service to the project which will do a background process. The user can logout from the site, but the service will run in background. It may take hours to finish he task. I have the following questions.
Can I include this windows service as a separate project in my asp.net web application? If so where it should be added? This windows service may call from the Business layer. And the service will interact to database. SO can I add it as a separate Service layer?
As I said the windows service will work in background, so I can create thread inside 'OnStart' event of windows service to do the operation. Am I correct? I know that it’s not a good practice to write long running process in 'OnStart' event. That’s why I am using threads. But if another user login to the website, the service will again call and it will create new worker thread. Is there any performance issue in this approach?
Thanks.