I am trying to set up a monitoring service for a database. Originally I had a windows service running on the same machine as the database and querying the database every 10 minutes. It was possible to change the time automatically by changing a value that I was storing in the machines registry.
I have been told that I need to relocate this service, as if the machine goes down, the service will not be available. I have been told also that opening the sql server (2005) to allow remote connections is not an option. The solution that I am hoping to use is to install a web page (.aspx) on the same machine as the database and use my windows service installed on another machine to send web requests to the web page, and get a specific web response.
This is the code that I would be using to sending the request and retrieving the response:
The problem that I am having is that I am unable to find any information on providing my own specific response from the web page. The value that I need to send back is a float. Any suggestions on how I can do this?
Mike55.
I have been told that I need to relocate this service, as if the machine goes down, the service will not be available. I have been told also that opening the sql server (2005) to allow remote connections is not an option. The solution that I am hoping to use is to install a web page (.aspx) on the same machine as the database and use my windows service installed on another machine to send web requests to the web page, and get a specific web response.
This is the code that I would be using to sending the request and retrieving the response:
Code:
WebRequest wRequest;
WebResponse wResponse;
System.IO.StreamReader sReader;
wRequest = System.Net.HttpWebRequest.Create("http://127.0.0.1/WebMonitor/Monitor.aspx");
wRequest.Method = "GET";
wResponse = wRequest.GetResponse();
sReader = new System.IO.StreamReader(wResponse.GetResponseStream());
String result;
result = sReader.ReadToEnd().Trim();
sReader.Close();
The problem that I am having is that I am unable to find any information on providing my own specific response from the web page. The value that I need to send back is a float. Any suggestions on how I can do this?
Mike55.