0

Is it possible to call a web application from within a windows service? I see alot of questions on calling web services inside of a web application but not vice versa. I need to have a windows service that calls my web application which polls my database every 15seconds. I was told that the web application cannot initiate the request on its own and must be called through a web service but I can't seem to find any examples that call a web application from a windows service. I have my application checking the database for changes but I need to implmenet that in a windows service so that it checks every 15seconds Does anybody know? Am I making sense?

Could something like this work for what I'm trying to accomplish?

Running a background service in a Web Application (no Windows Service was involved during this process)

user1270384
  • 711
  • 7
  • 24
  • 53

1 Answers1

1

SQLDependency (http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldependency.aspx) object in windows service to get that done.

Pritesh
  • 1,938
  • 7
  • 32
  • 46
  • Also you can call web application using webrequest http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx but your functional need does not make sense calling an web application, calling web service can be good idea. For web service consume WSDL and it works like any other API – Pritesh Apr 20 '12 at 00:27
  • Thanks, I read up on SQL Dependency, is it just as easy to implement on SQL server 2008 as it is on 2005? – user1270384 Apr 22 '12 at 21:43
  • @user1270384 yes, it is same on both, and quiet straight forward! If you implement this that would be "Observer Pattern" :) – Pritesh Apr 23 '12 at 04:31