Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Is it possible to schedule a web service?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
antonyliu2002@yahoo.com - 24 Jul 2007 04:04 GMT
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) - 24 Jul 2007 06:06 GMT
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.

Signature

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!
************************************************

>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.
[quoted text clipped - 17 lines]
>
> Any idea?  Thanks.
antonyliu2002@yahoo.com - 24 Jul 2007 18:18 GMT
On Jul 24, 1:06 am, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> 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
[quoted text clipped - 17 lines]
> Think outside the box!
> ************************************************

Thank you very much.  But I am not sure how the timeout strategy works.
Sergey Poberezovskiy - 24 Jul 2007 06:08 GMT
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.

> 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.
[quoted text clipped - 17 lines]
>
> Any idea?  Thanks.
antonyliu2002@yahoo.com - 24 Jul 2007 17:57 GMT
On Jul 24, 1:08 am, Sergey Poberezovskiy
<SergeyPoberezovs...@discussions.microsoft.com> wrote:
> Anthony,
>
[quoted text clipped - 29 lines]
>
> - 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.
John Timney (MVP) - 24 Jul 2007 10:01 GMT
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

>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.
[quoted text clipped - 17 lines]
>
> Any idea?  Thanks.
antonyliu2002@yahoo.com - 24 Jul 2007 18:20 GMT
On Jul 24, 5:01 am, "John Timney \(MVP\)"
<x_j...@timney.eclipse.co.uk> 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) - 24 Jul 2007 20:35 GMT
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

> On Jul 24, 5:01 am, "John Timney \(MVP\)"
> <x_j...@timney.eclipse.co.uk> wrote:
[quoted text clipped - 9 lines]
> have full access to our clients' windows system, and we are reluctant
> to have to get our clients involved in this process.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.