Check to see if Tomcat server is UP from C#
I am working in a multiple server environment and so have created a Management Program to start, stop and open pages on my Tomcat servers.
I want some开发者_如何学Go way to determine from C# whether the server is up at any particular point. I have tried connecting to ports but haven't had any luck. Does anyone know how to do this? Poll a port on an IP address to determine if Tomcat has been bound to it?
What you can do is create a windows service or forms app which uses httpRequests to request a specific page on your tomcat server. This page can for example contain the text "server online" In the httpResponse class it's possible to read the contents of the returned html code by the server.
If this html contains an error message, your server is probably down or misconfigured, if it contains the right text, your server is up and running.
You can also try to create a program to check the windows service status for the tomcat service. Note this will only tell you the service is running, not that it actually works the way it is supposed to.
You have to use JMX in connection with a web service maybe.
精彩评论