Averigüe si el servidor se está ejecutando, asp.net

I have a server and a website running 100% fine.

The thing is, I want my website to show on the default page "Status" of the server. I was thinking about pinging the server with this code:

Uri url = new Uri("http://www.abhigrgrgrgrgsheksur.com");
string pingurl = string.Format("{0}", url.Host);
string host = pingurl;
bool result = false;
Ping p = new Ping();
    PingReply reply = p.Send(host, 3000);
    if (reply.Status == IPStatus.Success)
        return true;
catch { }
return result;

The code is from a website I found online, not mine.

The thing is, if you put that code on the default page on the website, when people do "Reverse" its always pings the server, my question is, can it drop the server? Or get it stop working? Or anything like that? The server is not a website. It's a running process (MineCraft Server).

preguntado el 30 de junio de 12 a las 18:06

Ping don't mean IIS is serving pages, you'd be much better served by doing a HTTP get. -

2 Respuestas

If I understood correctly your worried about on every refresh of page it will ping and multiple ping call will be made

So the statement made in Remarks paragraph for Ping Class at http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx might help your concern

You cannot use the same instance of the Ping class to generate multiple simultaneous ICMP Echo requests. Calling Send while a SendAsync call is in progress or calling SendAsync multiple times before all previous calls have completed causes an InvalidOperationException.

Respondido el 30 de junio de 12 a las 18:06

the msdn link have examples on it - SombreroSoft

It will send multiple ping requests to the server. That's shouldn't make the server crash. Although you might need to check with your network administrator whether multiple PING requests form the same IP (the IP of your web server) won't be dropped by some firewall for example.

Respondido el 30 de junio de 12 a las 18:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.