Should I create a Windows service to run my C # code on a schedule?

I wrote a console application that sends MS Reports to emails .. (the reason is that I can easily check it if it works) I want this to continue daily at 6 a.m.

My idea was to write a service (so nooone would need to be logged in and the service would start). Therefore, I would like to call the static method directly in the WebService.

I have a solution with 1 project file, which is my console application (with settings, many links, etc.). I would like to add another project - Windows Service. My question is: how to do this easily, so I would not have to copy all the classes, etc. Into a windows service project?

Or am I completely out of the way? :)

Thank!

+3
source share
3 answers

It sounds like overkill to use the Windows service to send emails once a day. Why not just schedule a task in the task scheduler?

+10
source

You will have to reorganize your application. I would recommend three projects -

- - , .

-. .

. , , , . , , .

, .

+1

Create a class library and put the shared classes in this library.

0
source

Source: https://habr.com/ru/post/1725744/


All Articles