Reputation: 13267
I've got a web server and a database server, and I'd like to run a job that uses an existing C# DLL to access the database and perform some calculations.
Is the simplest method to create a console app in C# and schedule it on the web server (app server) to run against the DB server?
I see SSIS as an option, but I don't know that well, so I thought a console app scheduled as a task would be best.
What do you think?
Upvotes: 1
Views: 2409
Reputation: 15673
I'm a big fan of the console app + scheduled task approach. It tends to be cleaner, easier to test, and easier to re-run if something goes south. That said, if you can write the calculations in pure SQL, you could just run everything as a SQL job. Alternatively, you could take advantage of SQLCLR (.NET assemblies living within SQL Server and basically appearing as a sproc or UDF) and also run things entirely within the SQL job engine.
Upvotes: 1
Reputation: 1167
You can use Quartz.NET library (quartznet.sourceforge.net) for scheduling within your console app, it is open source and it works perfectly!
Upvotes: 0
Reputation: 137108
Yes the simplest solution is to create a separate console app and run it as a scheduled task.
You've got access to the web server and all the tools are already in place without having to install anything else.
Upvotes: 0
Reputation: 37205
You can also call your C# DLL from a PowerShell script, and execute that script as a Scheduled Task.
For operations that require immediate actions in the background I prefer to have a service for each of my projects.
Upvotes: 0
Reputation: 6182
You don't need to write a separate console application for that if the job is very minor. you can write a page separately and write a batch file i.e. a scheduler fr the same to schedule it. You can also schedule it through window's user interface. Apart for that, if your job is plan/step of a maintenance plan (like re-indexing, taking backup of db, defragmenting , cleaning up history/log etc) then create a maintenance plan for it from you sql server, under "Management" folder available.
Upvotes: 0