I wanna create a notification system on my website?(something like stack-overflow)
How can we schedule a task for mailing the notification for users on each 24 hours?
Can we use MVC4 or we should use windows service ?
Edit:
My Experience with using FluentScheduler in 3 month within a MVC4 App .
FluentScheduler is easy to config and using but it doesn't run tasks any time. Sometimes run and sometimes doesn't run.
I think the best way for scheduling is Windows Service to ensure running a task at the specific time.
Found this to be an awesome scheduler, FluentScheduler
Usage:
// Schedule an ITask to run at an interval
Schedule<MyTask>().ToRunNow().AndEvery(2).Seconds();
You need a .Net Job Scheduler. Here is a good one: http://quartznet.sourceforge.net/
You can use ATrigger scheduling service. A .Net library is also available to create scheduled tasks without overhead. Errors log, Analytics, Tasks Listings and more benefits.
Disclaimer: I was among the ATrigger team. It's a freeware and I have not any commercial purpose.
maybe you wanna use a scheduled task. Doing this in a MVC is a bad idea (mixing responsabilities) and building a windows service looks like an overkill to me (because is something doesn't need to run all the time).
I use scheduled task of windows.
I have build a little app than enter a record in the bd, then access the website with this recordId(Guid) as a parameter.
In mvc i check if the id exist, if it exist i run tasks then delete the record in the db, if not i ignore it.
this way im able to add schedule with a param. without updating the app each time i need a new scheduled task. i just add a new task like
"myapp.exe /MyNewTaskName"
hope this help someone ;-)
First of all;
Add Nuget package Install-Package FluentScheduler
Add your registry class that inherit Registry and some code
// Schedule a simple task to run at a specific time
Schedule(() => System.Diagnostics.Debug.Write("This is from service " + DateTime.Now.Second+"\n"))
.ToRunNow().AndEvery(2).Seconds();
Register that registry class in Application_Start of Global.asax.cs
with TaskManager
TaskManager.Initialize(new Test());
GitHub
There is also a built-in option, QueueBackgroundWorkItem. It was added in .Net 4.5.2 and here is a guide on how to use it in MVC.
In addition to previously mentioned FluentScheduler you also have HangFire. And if you plan on deploying to Azure there's a handful of different services for this.
Related
This is a bit high-level solution based question: I have a website, and what I need to do is login->navigate->click category->check whether the specific content has come; every 10 mins.
There are quite a few third-party services, but they only checking the website uptime, which is not what I need.
Currently, I am thinking of silly way: create a selenium UI test, and run it every 10 mins, which seems pretty complex.
Feels like need some tool, so that I can run some extra js on a particular web to test my functionality. Any good solution for this? even some js framework, or even third-party payable service that I can direct make use of?
Thanks.
The best way to do this is :
Create a selenium test - Single main method that does all the steps.
Export it as a runnable jar
Schedule the .jar execution using windows scheduler.
Before scheduling the jar, once just double click the .jar file and see if the steps run smoothly.
Alternately you can try using vbscript (.vbs) file also.
In SSIS package i have multiple scripts running within a job. At any given time i want to read how many scripts have been executed eg, 5/10 (50%) have been completed. Please tell how can i achieve that?
Currently there is no such functionality provided by SSIS to track progress of package execution.
It seems you need to write your own custom utility/application to implement same or use third party one.
There are few ways to do -
Using a switch called /Reporting or /Rep of DTEXEC at the command-line . For example:
DTEXEC /F ssisexample.dtsx /Rep P > progress.txt
2.Implement package logging or customize it.
3 . Implement Event handler on required executable. You can also use OnPipelineRowsSent log of Data Flow Task.
If you want to write your own application then below thread will provide nice starting point.
How do you code the Package Execution Progress window in C#
In my experience, we are using another software to monitor the jobs that are running. http://en.wikipedia.org/wiki/CA_Workload_Automation_AE
You can also try to create your own application that runs on the background that checks that status of your jobs, through checking the logs.
I need to have a process or widget that every five minutes will check to see if there are any xlf files in the localization folder, and if any exist, will import them into Ektron. Is there a way within Ektron to have something scheduled.
I don't think there is any scheduler program inside Ektron.
To schedule a task you could look at using one of the following:
Quartz.Net
Command line programs called by Task Scheduler
Alternatively, you could look at using an Ektron plugin, which will get fired when certain Ektron events occur (e.g. content published). However, in my experience plugins/extensions are poorly supported and documented.
You can try creating a Windows service to perform the scheduling.
Details on the localization API and how localization performed can be found at:
root\Workarea\controls\content\localization_uc.ascx.cs in your Ektron site.
I'd recommend trying something similar to what Ken McAndrew did for an alias scheduler. Details here: Manual Alias Scheduler
I have managed to do Continuous deployment for my Web project using TFS Msbuild.
I have goggled for few hours but couldn't find a relative link to achieve Continuous Deployment for windows service.
Possible to do CD for windows service using TFS Build Definitions? i.e for every check in below steps should be performed, I am using TFS2010 with Windows Server 2008 R2
1] Stop Service,
2] Copy respective Project folder from (Source) Build server to (Destination Server)'staging server1' or 'staging server2'
3] Start Services (willing to do this step manually)
Any blog,tutorial references to achieve this? My guess is need to use Power shell scripts but not sure.
Should be ok, you'll need to install an agent on the box you're deploying to. And you'll need to be able to exit the XAML templates (you'll probably want to copy your existing template that does your build and just add the stop/copy/start stuff onto the end of it).
After your CI build, you'll need to edit it (the XAML template) to start and stop the service you can use the "invoke process" activity (you'll probably want to do something like make it generic and pass in the service name as an argument - note you can change the display names etc in the Metadata argument so it appears meaningful in your build definition).
As far as copying stuff across goes, you can do this fairly easily by accessing properties like the drop location.
Should be fairly straight forward - once you get your head round modifying the templates!
Edit:
Sorry for not responding sooner, I'd have to revise my earlier comment, this isn't as straight forward as it seems unless you really know what you want, I have been thinking about this and like skinning cats, there are more than one ways to achieve this... I've rewritten this a few times so I hope the edit's make sense :)
Boils down to the following:
1) Pass into your template the build agent/machine you want to run this on (this can be done as a simple string, or as an AgentReservationSpec - up to you), since it's unlikely to be the machine that you run your actual CI build on. This is done in the Arguments section of the XAML, as noted before, if you want to edit the display name/description you can edit the Metadata Argument. This machine needs a TFS agent installed of course.
2) Run the task on the remote machine, this is done by adding the Agent Scope activity into your template, you will have to use the info from step 1 to get the ReservationSpec (so would be easier if you add the argument as an AgentReservationSpec or you'll need to resolve this in the template)
2.1) Run the stop/uninstall, this is done via dropping in a (two actually) Invoke Process activity, Invoke Process can take arguments and you need to point it to the executable you're executing, so you'll want to use this, one for the NET command (i.e. NET STOP ), and one for InstallUtil.exe.
2.2) Copy the files from your CI to the remote server, you can use the Copy Directory activity for this, it needs a couple of parameters, the main one is the source location, you should be able to drop in a GetBuildDetail activity, give it a name then reference .DropLocation to get this, destination is wherever you like you're installing to.
2.3) Install the new service as step 2.1, you need to use Invoke Process to install the service, then you can use another to start the service up.
I haven't covered everything, but I haven't set this up myself so I'm sure there are a few pitfalls or things I haven't though of. Off the top of my head this makes sense, but maybe someone that knows better can poke a few holes in it :)
I am working on a windows forms project that will allow a user to have an interface to the database, and another will be a nightly run process file that will update the database table.
The user will add new records to the table, whereas the nightly process will update the columns with new values (think mortgage interest rates)
Both these projects will be using the same business logic component that has the calculations needed to enter values into the table.
The way I am figuring this out, is that I will have two exe's (one for the interface and one for the nightly process) and have a central object that will host the calculations. What would be the best object for this purpose?
A class file?
A windows service? (I want to stay away from a windows service, because it will have to be running all the time)
Thanks
You're on the right track.
The central object with your business logic components should be a Class Library project (outputting a DLL).
The Winform project that allows users to interface with the database should reference (and use) your Class Library project.
The nightly process should run a Windows Console Application that would also reference and use your Class Library project. Like Davita suggests the nightly process should be called from a Windows Scheduled Task.
if I understand correctly your question, you can consider Windows Task Scheduler. You create a job which will execute your exe at any given time of day.