Scheduled task or service to work with a regular database in C #?

I have a web server and a database server and I would like to run a job that uses an existing C # DLL to access the database and do some calculations.

The easiest way to create a console application in C # and schedule it on a web server (application server) to work with a DB server?

I see SSIS as an option, but I don't know which is good, so I thought a console app scheduled as a task would be better.

What do you think?

+1


a source to share


5 answers


I'm a big fan of the console app + planned approach. It tends to be cleaner, easier to test, and easier to repeat if things go south. However, if you can write the calculations in pure SQL, you can simply run everything as a SQL job. Alternatively, you can use SQLCLR (.NET assemblies that live in SQL Server and are mostly sproc or UDFs) and also run everything entirely within the SQL engine.



+1


a source


You don't need to write a separate console application for this if the task is very minor. you can write the page separately and write a batch file, that is, a scheduler, with the same to schedule it. You can also schedule it through the window UI. Also, if your work is a maintenance plan / step (e.g. re-indexing, db backup, defragmentation, history / log cleanup, etc.), then create a maintenance plan for it from your sql server under Manage msgstr "accessible folder.



0


a source


You can also call your C # DLL from a PowerShell script and execute the script as a scheduled task.

For operations that require immediate background action, I prefer to have a service for each of my projects.

0


a source


You can use the Quartz.NET library (quartznet.sourceforge.net) for scheduling in your console application, this is open source and it works great!

0


a source


Yes, the simplest solution is to create a separate console application and run it as a scheduled task.

You have access to a web server and all the tools are already installed without having to install anything else.

0


a source







All Articles