Is it possible to schedule a web service?

Discussion in 'ASP .Net' started by antonyliu2002@yahoo.com, Jul 24, 2007.

  1. Guest

    I have a web service, which needs to run at regular intervals (e.g.,
    once every 2 hours) to create some PDF files for users to download.

    I can certainly create a web application which lets user click a
    button and generates the PDF file.

    But since the PDF files are gonna be the same for all users, so, it
    does not make sense to waste the server resources.

    Is it possible to schedule a web service to run at regular
    intervals?

    I do not want to use the Windows Task Scheduler, part of the reason is
    that we do not have full access to our clients' Windows system, and
    it's cumbersome to get them involved in setting up the task
    scheduler. So, I would like to do this completely within the IIS
    context.

    I googled a little, but could not find anything helpful.

    Any idea? Thanks.
     
    , Jul 24, 2007
    #1
    1. Advertising

  2. You either have to use a scheduler or set up a service on the box that runs
    on a timer. You might be able to kludge this with an HTTP Handler, but I am
    not sure I would head down that path.

    One thing to consider, as a poor man's method, is to have a "time" set into
    application that increments by two hours each time it is hit. Then,
    automatically update the files when a user hits the site and the "time" has
    timed out.

    Or, you could make teh PDF request through a page and refresh based on a
    "timer" value. This way, you are only updating when people are requesting
    the file, but you are updating all PDFs from a single page or HTTP Handler.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com
    Co-author: Microsoft Expression Web Bible (upcoming)

    ************************************************
    Think outside the box!
    ************************************************
    <> wrote in message
    news:...
    >I have a web service, which needs to run at regular intervals (e.g.,
    > once every 2 hours) to create some PDF files for users to download.
    >
    > I can certainly create a web application which lets user click a
    > button and generates the PDF file.
    >
    > But since the PDF files are gonna be the same for all users, so, it
    > does not make sense to waste the server resources.
    >
    > Is it possible to schedule a web service to run at regular
    > intervals?
    >
    > I do not want to use the Windows Task Scheduler, part of the reason is
    > that we do not have full access to our clients' Windows system, and
    > it's cumbersome to get them involved in setting up the task
    > scheduler. So, I would like to do this completely within the IIS
    > context.
    >
    > I googled a little, but could not find anything helpful.
    >
    > Any idea? Thanks.
    >
     
    Cowboy \(Gregory A. Beamer\), Jul 24, 2007
    #2
    1. Advertising

  3. Anthony,

    Web Service similar to a Web Application does not run by itself -
    somebody/something has to trigger it. In your particular case, you may not
    necessarily want to run the service as a separate process - you can check on
    every (user) call whether the required file is already created and stored (in
    the file system or ASP cache) and then either create one or retrieve it from
    the storage.

    "" wrote:

    > I have a web service, which needs to run at regular intervals (e.g.,
    > once every 2 hours) to create some PDF files for users to download.
    >
    > I can certainly create a web application which lets user click a
    > button and generates the PDF file.
    >
    > But since the PDF files are gonna be the same for all users, so, it
    > does not make sense to waste the server resources.
    >
    > Is it possible to schedule a web service to run at regular
    > intervals?
    >
    > I do not want to use the Windows Task Scheduler, part of the reason is
    > that we do not have full access to our clients' Windows system, and
    > it's cumbersome to get them involved in setting up the task
    > scheduler. So, I would like to do this completely within the IIS
    > context.
    >
    > I googled a little, but could not find anything helpful.
    >
    > Any idea? Thanks.
    >
    >
     
    =?Utf-8?B?U2VyZ2V5IFBvYmVyZXpvdnNraXk=?=, Jul 24, 2007
    #3
  4. Create small console exe that consumes the webservice and schedule it using
    windows scheduler.

    Regards

    John Timney (MVP)
    http://www.johntimney.com
    http://www.johntimney.com/blog


    <> wrote in message
    news:...
    >I have a web service, which needs to run at regular intervals (e.g.,
    > once every 2 hours) to create some PDF files for users to download.
    >
    > I can certainly create a web application which lets user click a
    > button and generates the PDF file.
    >
    > But since the PDF files are gonna be the same for all users, so, it
    > does not make sense to waste the server resources.
    >
    > Is it possible to schedule a web service to run at regular
    > intervals?
    >
    > I do not want to use the Windows Task Scheduler, part of the reason is
    > that we do not have full access to our clients' Windows system, and
    > it's cumbersome to get them involved in setting up the task
    > scheduler. So, I would like to do this completely within the IIS
    > context.
    >
    > I googled a little, but could not find anything helpful.
    >
    > Any idea? Thanks.
    >
     
    John Timney \(MVP\), Jul 24, 2007
    #4
  5. Guest

    On Jul 24, 1:08 am, Sergey Poberezovskiy
    <> wrote:
    > Anthony,
    >
    > Web Service similar to a Web Application does not run by itself -
    > somebody/something has to trigger it. In your particular case, you may not
    > necessarily want to run the service as a separate process - you can check on
    > every (user) call whether the required file is already created and stored (in
    > the file system or ASP cache) and then either create one or retrieve it from
    > the storage.
    >
    >
    >
    > "" wrote:
    > > I have a web service, which needs to run at regular intervals (e.g.,
    > > once every 2 hours) to create some PDF files for users to download.

    >
    > > I can certainly create a web application which lets user click a
    > > button and generates the PDF file.

    >
    > > But since the PDF files are gonna be the same for all users, so, it
    > > does not make sense to waste the server resources.

    >
    > > Is it possible to schedule a web service to run at regular
    > > intervals?

    >
    > > I do not want to use the Windows Task Scheduler, part of the reason is
    > > that we do not have full access to our clients' Windows system, and
    > > it's cumbersome to get them involved in setting up the task
    > > scheduler. So, I would like to do this completely within the IIS
    > > context.

    >
    > > I googled a little, but could not find anything helpful.

    >
    > > Any idea? Thanks.- Hide quoted text -

    >
    > - Show quoted text -


    Thanks. I think I probably check the file modification time with the
    current time. If their difference is > 2, then create a new PDF,
    otherwise, don't create a new one let the user download the existing
    PDF.

    Of course, there may be a reader/writer race condition if more than
    one users wants to download the PDF at the same time. But, we may be
    able to synchronize using lock, right?

    Sorta enlightenment from what you said.
     
    , Jul 24, 2007
    #5
  6. Guest

    On Jul 24, 1:06 am, "Cowboy \(Gregory A. Beamer\)"
    <> wrote:
    > You either have to use a scheduler or set up a service on the box that runs
    > on a timer. You might be able to kludge this with an HTTP Handler, but I am
    > not sure I would head down that path.
    >
    > One thing to consider, as a poor man's method, is to have a "time" set into
    > application that increments by two hours each time it is hit. Then,
    > automatically update the files when a user hits the site and the "time" has
    > timed out.
    >
    > Or, you could make teh PDF request through a page and refresh based on a
    > "timer" value. This way, you are only updating when people are requesting
    > the file, but you are updating all PDFs from a single page or HTTP Handler.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBAhttp://gregorybeamer.spaces.live.com
    > Co-author: Microsoft Expression Web Bible (upcoming)
    >
    > ************************************************
    > Think outside the box!
    > ************************************************


    Thank you very much. But I am not sure how the timeout strategy works.
     
    , Jul 24, 2007
    #6
  7. Guest

    On Jul 24, 5:01 am, "John Timney \(MVP\)"
    <> wrote:
    > Create small console exe that consumes the webservice and schedule it using
    > windows scheduler.
    >
    > Regards
    >
    > John Timney (MVP)http://www.johntimney.comhttp://www.johntimney.com/blog
    >


    O, I know that works, and I did that before, but this time, we do not
    have full access to our clients' windows system, and we are reluctant
    to have to get our clients involved in this process.
     
    , Jul 24, 2007
    #7
  8. There are right ways and wrong ways to do things. My suggestion is the
    right way - make your client see that and do the work for them if you have
    to.

    You could probably use SQL server and use that to call a webservice on a
    timer job (if your using it).

    You could even likely invoke a thread in application on start event that
    acts as a poll and spawns your webservice.

    Regards

    John Timney (MVP)
    http://www.johntimney.com
    http://www.johntimney.com/blog


    <> wrote in message
    news:...
    > On Jul 24, 5:01 am, "John Timney \(MVP\)"
    > <> wrote:
    >> Create small console exe that consumes the webservice and schedule it
    >> using
    >> windows scheduler.
    >>
    >> Regards
    >>
    >> John Timney (MVP)http://www.johntimney.comhttp://www.johntimney.com/blog
    >>

    >
    > O, I know that works, and I did that before, but this time, we do not
    > have full access to our clients' windows system, and we are reluctant
    > to have to get our clients involved in this process.
    >
     
    John Timney \(MVP\), Jul 24, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christopher Reed

    Re: Schedule in asp.net

    Christopher Reed, Jan 10, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    611
    Christopher Reed
    Jan 10, 2006
  2. Zeng
    Replies:
    1
    Views:
    404
    Lucas Tam
    Apr 20, 2005
  3. Michael Fan
    Replies:
    2
    Views:
    148
    Michael Fan
    Jul 16, 2004
  4. gabe

    UDDU Web Service Directory? MLB Schedule

    gabe, Dec 21, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    154
  5. Leo Violette
    Replies:
    0
    Views:
    1,090
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page