SlideShare a Scribd company logo
ASP.NET Health Monitoring
Milan Negovan
MILAN
NEGOVAN
ROASTS ASP.NET WITH WEB STANDARDS
ASP.NET CONSULTING SERVICES
http://aspnetresources.com
milan@aspnetresources.com
9 times of out 10
there’s
nothing
you can
do
But…
You must
know
about it
Exception handling
“greatest hits”
Why I think “trying
again” is a bad idea.
catch (Exception ex)
{
string txt = ex.Message;
}
Exhibit A: a meaningless assignment
catch (Exception XXX)
{
string txt = XXX.Message;
}
Exhibit B: an adult version of the same
catch (Exception ex)
{
return false;
}
Exhibit C: a “magic” return value
catch (Exception ex)
{
res = -1;
}
Exhibit D: C++ blues
catch (Exception ex)
{
}
Exhibit E: horrible exception swallowing
catch { }
Exhibit F: same
catch (Exception Ex)
{
int i;
i=0;
}
Exhibit G: spinning one’s wheels
catch (Exception ex)
{
throw ex;
}
Exhibit H: you gain what again?
public static bool SendEmail (
string To,
string From,
string Subject,
string Body,
bool HtmlFormatted,
out Exception error)
{
//...
}
Exhibit I: catch me if you can
Why so averse to
exceptions?
Set up a custom error page
<customErrors
defaultRedirect="~/errors/GenericError.aspx"
mode="RemoteOnly" />
Save yourself embarrassment
So what is Health
Monitoring about?
The “what”
What do you want to be notified about?
Preconfigured event mappings:
•All events. Anything and everything that happens on
your site.
•Application Lifetime Events. Application compilation,
start-up and shutdown.
•All Errors. Any and all errors on the site.
•Infrastructure Errors. Compilation, configuration, parse,
etc, errors.
•Request Processing Errors. View state and validation
errors, as well as all unhandled exceptions.
Demo
Custom events
The “how”
How do you want them delivered?
ASP.NET 2.0 ships with the
following providers:
• Windows Event Log
• SQL Server
• E-mail
• WMI
• Diagnostics Tracing
Custom providers
Look it up ;)
Profiles: default and critical
<profiles>
<add
name="Default"
minInstances="1"
maxLimit="Infinite"
minInterval="00:01:00" />
<add
name="Critical"
minInstances="1"
maxLimit="Infinite"
minInterval="00:00:00" />
</profiles>
Buffering
Look it up ;)
By default all errors are logged in the
system event log
<rules>
<add
name="All Errors Default"
eventName="All Errors"
provider="EventLogProvider"
profile="Default"
minInstances="1"
maxLimit="Infinite"
minInterval="00:01:00" />
…
</rules>
Demo
A simple exception thrown and
written to the system event log.
Tip
Remember to deploy with debug
symbols.
Health Monitoring as a
convenient way to keep
track of whose fault it is.
Questions
Goodies
 Keeping Pulse on Your Site With ASP.NET 2.0
Health Monitoring
 Why So Averse To Exceptions?
 How To: Instrument ASP.NET 2.0 Applications for
Security
 How to: Send E-mail for Health Monitoring
Notifications
 Raising Custom ASP.NET Health Monitoring
Events Example

More Related Content

Similar to Health Monitoring

A miało być tak... bez wycieków
A miało być tak... bez wyciekówA miało być tak... bez wycieków
A miało być tak... bez wycieków
Konrad Kokosa
 
MongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-es
MongoDB
 
Errors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 librariesErrors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 libraries
PVS-Studio
 
Do more with less code in a serverless world
Do more with less code in a serverless worldDo more with less code in a serverless world
Do more with less code in a serverless world
jeromevdl
 
Why Windows 8 drivers are buggy
Why Windows 8 drivers are buggyWhy Windows 8 drivers are buggy
Why Windows 8 drivers are buggy
PVS-Studio
 
CodeChecker summary 21062021
CodeChecker summary 21062021CodeChecker summary 21062021
CodeChecker summary 21062021
Olivera Milenkovic
 
Azure SQL Database - Connectivity Best Practices
Azure SQL Database - Connectivity Best PracticesAzure SQL Database - Connectivity Best Practices
Azure SQL Database - Connectivity Best Practices
Jose Manuel Jurado Diaz
 
Why Windows 8 drivers are buggy
Why Windows 8 drivers are buggyWhy Windows 8 drivers are buggy
Why Windows 8 drivers are buggy
Andrey Karpov
 
Surviving javascript.pptx
Surviving javascript.pptxSurviving javascript.pptx
Surviving javascript.pptx
Tamas Rev
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter Lawrey
JAXLondon_Conference
 
Anomalies in X-Ray Engine
Anomalies in X-Ray EngineAnomalies in X-Ray Engine
Anomalies in X-Ray Engine
PVS-Studio
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is Human
Alex Liu
 
Price of an Error
Price of an ErrorPrice of an Error
Price of an Error
Andrey Karpov
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
Tomek Kaczanowski
 
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming
Balavignesh Kasinathan
 
Back To The Future.Key 2
Back To The Future.Key 2Back To The Future.Key 2
Back To The Future.Key 2
gueste8cc560
 
Asp.net tips
Asp.net tipsAsp.net tips
Asp.net tips
actacademy
 
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
Andrey Karpov
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
Denis Voituron
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
Pascal Rettig
 

Similar to Health Monitoring (20)

A miało być tak... bez wycieków
A miało być tak... bez wyciekówA miało być tak... bez wycieków
A miało być tak... bez wycieków
 
MongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-esMongoDB World 2019: Life In Stitch-es
MongoDB World 2019: Life In Stitch-es
 
Errors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 librariesErrors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 libraries
 
Do more with less code in a serverless world
Do more with less code in a serverless worldDo more with less code in a serverless world
Do more with less code in a serverless world
 
Why Windows 8 drivers are buggy
Why Windows 8 drivers are buggyWhy Windows 8 drivers are buggy
Why Windows 8 drivers are buggy
 
CodeChecker summary 21062021
CodeChecker summary 21062021CodeChecker summary 21062021
CodeChecker summary 21062021
 
Azure SQL Database - Connectivity Best Practices
Azure SQL Database - Connectivity Best PracticesAzure SQL Database - Connectivity Best Practices
Azure SQL Database - Connectivity Best Practices
 
Why Windows 8 drivers are buggy
Why Windows 8 drivers are buggyWhy Windows 8 drivers are buggy
Why Windows 8 drivers are buggy
 
Surviving javascript.pptx
Surviving javascript.pptxSurviving javascript.pptx
Surviving javascript.pptx
 
Lambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter LawreyLambdas puzzler - Peter Lawrey
Lambdas puzzler - Peter Lawrey
 
Anomalies in X-Ray Engine
Anomalies in X-Ray EngineAnomalies in X-Ray Engine
Anomalies in X-Ray Engine
 
To Err Is Human
To Err Is HumanTo Err Is Human
To Err Is Human
 
Price of an Error
Price of an ErrorPrice of an Error
Price of an Error
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming
 
Back To The Future.Key 2
Back To The Future.Key 2Back To The Future.Key 2
Back To The Future.Key 2
 
Asp.net tips
Asp.net tipsAsp.net tips
Asp.net tips
 
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
PVS-Studio. Static code analyzer. Windows/Linux, C/C++/C#. 2017
 
A la découverte de TypeScript
A la découverte de TypeScriptA la découverte de TypeScript
A la découverte de TypeScript
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 

Health Monitoring