Link to home
Start Free TrialLog in
Avatar of AlHal2
AlHal2Flag for United Kingdom of Great Britain and Northern Ireland

asked on

detect network outage

How can I get my asp.net application to give me a message indicating the network is down?  Can I test whatever code you give me by pulling the network cable out of the back of my PC or do I need to wait for a genuine outage?

I just realised that if the app is on the web server and the application on the user's machine can't connect to that web server then no ASP code will be executed.  What about something on the user's machine or do you have any other suggestions?

Related to this, is there a way of detecting a failure to connect to the database and sending a proper excepction message?
Avatar of Rob
Rob
Flag of Australia image

As you say your network is down (from your point of view) if you pull the cable out of the back of your pc BUT from the webserver's view (and your .NET app) there is nothing wrong.

I'm assuming you mean if your webserver is disconnected from the "rest of the world"?  Usually this would be done by another server or machine on the network that is monitoring your webserver or application or service.  

There are many off the shelf products for this such as Nagios.  Quick google search to find others

Unless I'm missing something, there is really no need for your app to detect whether it is online or not as that wasn't what it was designed for yeah?  sure it can detect whether it's been able to connect to a database or not or open a file properly or whatever but as for actual monitoring I would go with an IT Monitoring tool.

When you're app does fail to connect to the database it would be a good idea to log it in a file and send an email to yourself etc.  If the network is down then you'll have other issues anyway.
Avatar of AlHal2

ASKER

The problem we were having is that the GUIs seemed to be down (ie when people clicked the link it failed) for a few minutes then fine again.
I assumed it was a network issue, but it could have been a server issue.  It was not a database issue as the error message appeared before any db connection had been made.
Would Nagios and co detect this?
ASKER CERTIFIED SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AlHal2

ASKER

All I know is that Internet explorer sometimes says the site is not available.  
I also need to find out about server logs.
I guess you've answered the question, so here are the points.
thanks for the points... i'll keep a lookout if you post any more questions