Prevent and troubleshoot runtime issues

Objective

Troubleshoot performance, security, and errors; implement tracing, logging, and debugging including IntelliTrace; enable and configure health monitoring including Performance Monitor; configure and use App Insights runtime telemetry

Troubleshoot performance, security, and errors

  • Use Performance Wizard in Visual Studio
    • Analyze –> Perfomance Profiler (VS 2017 Community edition)Available Targets:
      • Startup project, Running ProcessExecutableASP.NET (running on IIS)Running App (windows Store App)Installed App (Windows Store App)
  • Using Performance Monitor
  • Troubleshooting Security Issues

implement tracing, logging, and debugging including IntelliTrace

  • Logging tools: NLog & Log4Net
  • Create one or more trace listeners: TracingTextWriterTraceListener, EventLogTraceListener, DelimitedListTraceListener, and XmlWriterTraceListener
  • HandleErrorAttribute
  • handle errors at the controller level by overriding the controller’s OnException method
  • capture errors through a custom error flter. This enables you to create
    error-handling in one place and use it throughout your application
  • Enforcing conditions by using code contracts. download and install the Code Contracts Editor Extensions from the Visual Studio Gallery
  • Enabling and configuring health monitoring

Troubleshooting IIS Performance Issues or Application Errors using LogParser

Debugging a published Azure cloud service with Visual Studio and IntelliTrace

Understanding IntelliTrace Part V: Advanced IntelliTrace Settings

ASP.NET Health Monitoring Overview

Health monitoring

Set up Application Insights for your ASP.NET website

Start Monitoring Your ASP.NET Core Web Application