2

I want to develop a windows service which will be accepting a datatable from an aspx page. Both the windows service and the website are hosted on same machine.

Also I need to set a date and time on which this service is to work. this date and time are to change according to customer needs. once again the date and time are to be fed from the aspx page.

3
  • 3
    Okay, you're creating this service... what is your question? Commented Aug 18, 2010 at 13:23
  • Sounds like maybe a scheduled task would be more apprpriate? Commented Aug 18, 2010 at 13:25
  • I need to know any means how to pass data from an aspx page to windows service Commented Aug 18, 2010 at 13:25

6 Answers 6

3

The question is a bit broad, meaning it's hard to give a good example with a code sample unless you're a bit more specific about what you have already figured out, and what you need help with. Based on that, I'm guessing you're not sure where to start.

Two possibilities:

Simple: Have the ASPX page and the server both point to the same database. In order for the aspx page to send data to the service, the ASPX page should update the database; the service should read from it. Just set the service up to poll periodically. You can also store you r dates in the DB and have the ASPX page update the dates.

More advanced: Use WCF (Windows Communication Foundation) to allow the service to listen for requests from the ASPX page. (Google WECF for example code). You can pass DataSets as parameters into functions, even using WCF.

Sign up to request clarification or add additional context in comments.

Comments

1

http://www.codeproject.com/KB/webservices/myservice.aspx

http://www.codeproject.com/KB/shell/ScheduledTaskWizard.aspx

Comments

1

Like any other executable, Windows service has Main method with parameters, if you want to pass some data to service when it starts, you can use that parameters, for example you can dump dataset to xml file and pass the path of that file on start

 static void Main(string[] args)
 {
            // Do something with args array, but il make sure its not null first.
 }

But if you want to pass parameters during execution time, you can use WCF Windows Service host

Comments

0

It sounds like the service should be pretty much running all the time (every minute, perhaps) and when it runs all of its logic is wrapped in a single conditional which checks the database to see if it's "supposed to run now." The web page would be maintaining that data in the database.

Comments

0

If you write your service to run constantly, you can use the FileSystemWatcher to look for an xml file that the aspx page can generate (probably not the most secure since that means there will be a directory someone can write to using a web page).

Comments

0

Put a WPF endpoint in your service?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.