0

I have windows server 2008 and ASP.NET application running on it. There is a page that renews all subscribers and should be run every 1 hour or so. I want to have this done automatically every hour.

Problem is if i assign Windows Schedule Task to it and make page with code a homepage it will open 24 browser windows per day. I can write a page that auto closes after execution with Javascript on it ( window.close() ) but is there any other more elegant way to execute the page on Windows Server 2008 ?

eugeneK
  • 410
  • 2
  • 8
  • 18
  • Why are you doing this trough a web page? Wouldn't it be easier to create a web service, then call it on schedule? – Arseni Mourzenko Jul 18 '10 at 07:02
  • Can i access web services from scheduling? Anyway i don't know to create a service unless it is web service. – eugeneK Jul 18 '10 at 07:05
  • @eugeneK: I talked about web services since it will easily let you access the resource programmatically, outside the browser. In general, unless the page has to be accessed by regular users, there is no need to do an ASPX page. – Arseni Mourzenko Jul 18 '10 at 07:09
  • you're right about services but i've never wrote one. I mean WCF ones because you cannot execute simple web service from Windows. I think i will stick to wGet and Task Scheduler at the moment. thanks anyway. – eugeneK Jul 18 '10 at 07:20
  • 1
    Writing both WCF and web services is as easy as creating a new ASPX page. Both can be hosted in IIS. So you have only to choose a good template in Visual Studio (if you are using VS). Try it. Good luck. – Arseni Mourzenko Jul 18 '10 at 07:23
  • Thanks mate! I will learn to make WCF or Windows Service this weekend. Shouldn't be too hard to create one especially if i'm dealing with ASP.NET for 3 years or so. – eugeneK Jul 18 '10 at 07:38

1 Answers1

1

You have several solutions.

  1. Use Wget to load a page without opening a browser.

  2. If you are a developer, create your own Windows service which will load the page on background every hour. I'm not sure it is better than using Wget with Task Scheduler.

  3. If there is no reason the have a web page doing subscribers renewal, do a web service or a WCF service instead, then call it once per hour either through a Windows service or a simple application called through Task Scheduler.

Arseni Mourzenko
  • 2,275
  • 5
  • 28
  • 41