Monitoring website via Windows Service - HELP ME

  • Thread starter Thread starter Guilherme
  • Start date Start date
G

Guilherme

Guys,
I'm new in .NET and i have to do a Windows Service that will monitoring two things:
1)If a website is online.
2)If a Data Base is ok, and the time of response os this Data Base.
Anybody can help me ??
Thanksss..

Guilherme
(e-mail address removed)
 
1. (a) If a web page of a website doesn't have any errors it will return
StatusCode "OK". Read more to know about this.
You can create a page in your web application that just runs without any
error. Then from remote application use these objects.
Check out System.Net.HttpWebRequest and System.Net.HttpWebResponse
objects. There is a property of System.Net.HttpWebResponse
called StatusCode. Check if thats ok or not. This way is from a remote
application to ping and check if your page (and site) is working fine.

(b) Another way could be pinging port 80 (or whichever port your web
application is hosted at) of the webserver and see if its alive. This is
socket programming.

2. Check out above point (b). Ping for the DB port. SQLServer uses port
1433 FYI.
or
Have a System.Data OleDBConnection object and open the connection and
check the state property. You can set the timeout value of the connection
object as well.

Hope this helps!
Harman
 
Harman,
Thankyou very much.... your tip will help me.. now I think I can do
something about that..
thankss

Guilherme
 
Back
Top