Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 8th, 2008, 07:09 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default How to dynamically set windows service C# ,asp.ne

Is there any way to dynamically set the windows service scheduling time??

e.g initially I have created Windows Services in C# that needs to be run every mid-night.
now master admin of the web application can change the scheduler time .i.e he/she want to run the scheduler after every 1 hr or every Saturday.
Any pointer or example will be helpful to me !!
Thanks in Advance.



Cheers :)

vinod
__________________
Cheers :)

vinod
 
Old April 8th, 2008, 07:23 AM
Authorized User
 
Join Date: Sep 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Control Panel -> Scheduled Tasks

Create a little program that calls the Web Service and use Scheduled Tasks to run it.
 
Old April 8th, 2008, 07:51 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Look, you should know better - have you tried searching google for this e.g. "scheduled tasks c#".

/- Sam Judson : Wrox Technical Editor -/
 
Old April 8th, 2008, 08:19 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Quote:
quote:Originally posted by vinod_yadav1919
 Is there any way to dynamically set the windows service scheduling time?? ... I have created Windows Services in C# that needs to be run every mid-night

Have you created an actual windows service or are you using the task scheduler to run a process?

If you have created an actual service, then the service must be performing its own scheduling. Thus you need some hook into it to manipulate settings within it. This can be done with .NET remoting.

-Peter
peterlanoie.blog
 
Old April 9th, 2008, 12:25 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi All !!
I have created windows service.
Peter I am able to see outside the window thourgh your answer, if possible would you give me some more inputs/pointer to proceed.

Sincere apology to others for more explanation!!
Well i am able to schedule a task .

Problem Area: once i have scheduled a task , I want to give one asp.net page that allows to modify the schedule task time.
e.g. Initially if i scheduled a task that run on midnight(12:00).
Now I want to give User Interface to a specific user(through a web page) where that user can modify it so that service should run at 8:00 o'clock rather than 12:00.

Thanks again .


Cheers :)

vinod
 
Old April 9th, 2008, 12:44 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Now I'm more confused.

You say you created a windows service. But then you go on to describe dealing with the windows scheduler.

If you have a windows service, it's running all the time. You don't need to use the windows scheduler to run the service (at least you shouldn't if it behaves like most services). Usually, services that do scheduled operations have their own scheduling and time keeping logic built in. Whether this is a time interval trigger that looks at some data store for information (such as a database table for jobs to execute) or a purely internal time trigger for a process.

-Peter
peterlanoie.blog
 
Old April 9th, 2008, 01:51 AM
Authorized User
 
Join Date: Sep 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I understood correctly he just want to make some web page which controls service's internal scheduling. What I would do is that...

1. Make the service read scheduling values from some config file (app.config for instance)
2. Create custom command handler in service that re-reads scheduling values when called
3. Create a web page which changes scheduling values and calls that custom command

More info here http://www.codeproject.com/KB/system...wsService.aspx (how to create service and handle custom commands) and here http://msdn2.microsoft.com/en-us/lib...ontroller.aspx (how to control service and send custom commands).





Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Service from ASP.NET premalm ASP.NET 2.0 Professional 1 September 16th, 2008 12:10 PM
Connected and disconnected architechture in asp.ne dilipv General .NET 8 February 28th, 2008 01:52 AM
How to set the windows service logon properties. vickytechi Visual Studio 2005 0 September 25th, 2007 08:27 AM
Accessing Windows service from a windows app sajid08 C# 1 October 6th, 2006 10:25 AM
creating Web TreeView Control dynamically in c#.ne pratik28 General .NET 0 June 22nd, 2006 07:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.