how can we write windows service and how we schedule it.

Posted by Bageshkumarbagi under C# on 12/27/2013 | Points: 10 | Views : 4524 | Status : [Member] | Replies : 7
hi,

I want to do some operation in my application on particular time.how can we write windows service and how we schedule it.plz suggest me how can i do it.

Thanks in advance.

Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied



Responses

Posted by: kgovindarao523-21772 on: 12/27/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

Refer this link and it is nice article written by ChvSri.

http://www.dotnetfunda.com/articles/show/1095/creating-a-windows-service-using-csharp

Thanks,
Govind


Thank you,
Govind

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bageshkumarbagi on: 12/27/2013 [Member] Starter | Points: 25

Up
0
Down
ya its working fine

but how can i integrate it on my project.

Thanks,
Bagesh Kumar Singh
Mark as answer if you have been satisfied

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Allemahesh on: 12/27/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
Now you can integrate windows service with you application by using "Start, Stop and Restart Windows Service by C#".

1. You need to install the windows service.
2. After that you need to Start and Stop service as per your requirement.

See the below link:-
http://www.csharp-examples.net/restart-windows-service/

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 12/27/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://www.codeproject.com/Articles/14353/Creating-a-Basic-Windows-Service-in-C
http://www.aspdotnet-suresh.com/2011/06/creating-windows-service-in-c-or.html
http://msdn.microsoft.com/en-us/library/zt39148a%28v=vs.110%29.aspx
http://www.c-sharpcorner.com/UploadFile/mahesh/window_service11262005045007AM/window_service.aspx
http://www.docstorus.com/viewer.aspx?code=7c7ccc28-6503-4779-877e-f350faab6741
http://dotnet.dzone.com/articles/creating-windows-services-c


Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 12/27/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Alternatively you can make a windows or console application.Add exe file if application into task scheduler in-build windows utility.
Here,you can also schedule time.
you can refer this links for task scheduler

http://support.microsoft.com/kb/178706

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sravan661 on: 2/11/2014 [Member] Bronze | Points: 25

Up
0
Down
Hi,
To create a windows service follow the link http://www.dotnetfunda.com/articles/show/1095/creating-a-windows-service-using-csharp
To schedule the windows service you can choose Windows Task Scheduler in which you you can schedule time at which the service should be automatically run.
to schedule
http://support.microsoft.com/kb/308569
http://www.makeuseof.com/tag/how-to-automate-windows-programs-on-a-schedule/

sravan

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 2/11/2014 [Member] Starter | Points: 25

Up
0
Down
@Bageshkumarbagi:

AS Sravan661 had already stated earlier:

CREATE a Batch file to start/stop your windows service,

NET STARTstarts the service
NET STOPends the service

Example NET START <YOUR SERVICE NAME > [Try it in CMD to test ]

Use Windows schedule Task to run Batch File:

For Windows 7,8
http://www.thewindowsclub.com/how-to-schedule-batch-file-run-automatically-windows-7

For Windows XP:
http://helpdeskgeek.com/how-to/schedule-a-batch-file-to-run-in-xp/

I recommend while creating a single batch file, Execute command to first STOP your service, then START your service and finally STOP service.


http://hashtagakash.wordpress.com/

Bageshkumarbagi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response