Implement Daemon on ASP.NET/C#/IIS?

I would like to implement the POP3 mailbox processing component for our mid-size website. Our site uses IPSwitch as the mail / smtp / pop host.

This processing component will allow us to offer services such as "reply to this discussion by email." This will need to be constantly run; or at least every 3-5 minutes or something else.

I'm sure I know what I need to do to implement this POP3 reader in C #, but I'm just not sure about the mechanism that does this every 3-5 minutes, it works when the machine reboots, etc. Task Scheduler seems a bit fragile. Should it be written instead as a Windows service? And if so, can I get some good recommendations on how to write Installable Service in C #? Or, if there is a better daemon launch plan in the IIS box, I would really appreciate it.

+3
source share
3 answers

OK, this tutorial on building a Windows service in C # looks exactly what I need. Any bugs you need to know about? Thanks for any advice.

Creating a Windows service in C #

0

, , . , global.asax, Application_Start -

Thread  thread = new Thread(new Task());
thread.Start();

:

private void Task()
{
//do something
Sleep(TimeSpan.FromMinutes(15).ToMilliseconds());
}

, , . :

http://nayyeri.net/how-to-build-a-task-scheduler-system-for-the-asp-net-part-1

, , /, , .

+1

Visual Studio, . Windows Service Project . , , .

, , - 100% , . , (, , ).

0
source

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


All Articles