Skip to content

Commit f22f11d

Browse files
authored
Update asp-net-exceptions.md
1 parent c7d47f9 commit f22f11d

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

articles/azure-monitor/app/asp-net-exceptions.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ You can set up Application Insights to report exceptions that occur in either th
2121

2222
To have exceptions reported from your server-side application, consider the following scenarios:
2323

24-
* **Azure web apps**: Add the [Application Insights Extension](./azure-web-apps.md).
25-
* **Azure Virtual Machines and Azure Virtual Machine Scale Sets IIS-hosted apps**: Add the [Application Monitoring Extension](./azure-vm-vmss-apps.md).
26-
* Install [Application Insights SDK](./asp-net.md) in your app code, or
27-
* **IIS web servers**: Run [Application Insights Agent](./status-monitor-v2-overview.md), or
28-
* **Java web apps**: Enable the [Java agent](./java-in-process-agent.md).
24+
* Add the [Application Insights Extension](./azure-web-apps.md) for Azure web apps.
25+
* Add the [Application Monitoring Extension](./azure-vm-vmss-apps.md) for Azure Virtual Machines and Azure Virtual Machine Scale Sets IIS-hosted apps.
26+
* Install [Application Insights SDK](./asp-net.md) in your app code, run [Application Insights Agent](./status-monitor-v2-overview.md) for IIS web servers, or enable the [Java agent](./java-in-process-agent.md) for Java web apps.
2927

3028
### Client side
3129

32-
The JavaScript SDK provides the ability for client-side reporting of exceptions that occur in web browsers. To set up exception reporting on the client, see [Application Insights for web pages](./javascript.md).
30+
The JavaScript SDK provides the ability for client-side reporting of exceptions that occur in web browsers. To set up exception reporting on the client, see [Application Insights for webpages](./javascript.md).
3331

3432
### Application frameworks
3533

@@ -48,7 +46,7 @@ With some application frameworks, more configuration is required. Consider the f
4846

4947
Open the app solution in Visual Studio. Run the app, either on your server or on your development machine by using <kbd>F5</kbd>. Re-create the exception.
5048

51-
Open the **Application Insights Search** telemetry window in Visual Studio. While debugging, select the **Application Insights** dropdown.
49+
Open the **Application Insights Search** telemetry window in Visual Studio. While debugging, select the **Application Insights** dropdown box.
5250

5351
![Screenshot that shows right-clicking the project and choosing Application Insights.](./media/asp-net-exceptions/34.png)
5452

@@ -99,7 +97,7 @@ Request details don't include the data sent to your app in a POST call. To have
9997

10098
## <a name="exceptions"></a> Capture exceptions and related diagnostic data
10199

102-
At first, you won't see in the portal all the exceptions that cause failures in your app. You'll see any browser exceptions, if you're using the [JavaScript SDK](./javascript.md) in your web pages. But most server exceptions are caught by IIS and you have to write a bit of code to see them.
100+
At first, you won't see in the portal all the exceptions that cause failures in your app. You'll see any browser exceptions, if you're using the [JavaScript SDK](./javascript.md) in your webpages. But most server exceptions are caught by IIS and you have to write a bit of code to see them.
103101

104102
You can:
105103

@@ -173,7 +171,7 @@ The properties and measurements parameters are optional, but they're useful for
173171

174172
Most browser exceptions are reported.
175173

176-
If your web page includes script files from content delivery networks or other domains, ensure your script tag has the attribute `crossorigin="anonymous"` and that the server sends [CORS headers](https://enable-cors.org/). This behavior will allow you to get a stack trace and detail for unhandled JavaScript exceptions from these resources.
174+
If your webpage includes script files from content delivery networks or other domains, ensure your script tag has the attribute `crossorigin="anonymous"` and that the server sends [CORS headers](https://enable-cors.org/). This behavior will allow you to get a stack trace and detail for unhandled JavaScript exceptions from these resources.
177175

178176
## Reuse your telemetry client
179177

@@ -325,11 +323,11 @@ There are several cases that the exception filters can't handle. For example:
325323
* Exception thrown during application startup.
326324
* Exception thrown in background tasks.
327325

328-
All exceptions *handled* by application still need to be tracked manually. Unhandled exceptions originating from controllers typically result in a 500 "Internal Server Error" response. If such a response is manually constructed as a result of a handled exception, or no exception at all, it's tracked in a corresponding request telemetry with `ResultCode` 500. However, the Application Insights SDK is unable to track a corresponding exception.
326+
All exceptions *handled* by application still need to be tracked manually. Unhandled exceptions originating from controllers typically result in a 500 "Internal Server Error" response. If such a response is manually constructed as a result of a handled exception, or no exception at all, it's tracked in a corresponding request telemetry with `ResultCode` 500. However, the Application Insights SDK can't track a corresponding exception.
329327

330328
### Prior versions support
331329

332-
If you use Web API 1 (and prior) of Application Insights Web SDK 2.5 (and prior), refer to the following examples to track exceptions.
330+
If you use Web API 1 (and earlier) of Application Insights Web SDK 2.5 (and earlier), refer to the following examples to track exceptions.
333331

334332
#### Web API 1.x
335333

@@ -411,7 +409,7 @@ namespace ProductsAppPureWebAPI.App_Start
411409
}
412410
```
413411

414-
Add this snippet to the services in WebApiConfig:
412+
Add this snippet to the services in `WebApiConfig`:
415413

416414
```csharp
417415
using System.Web.Http;
@@ -444,12 +442,12 @@ namespace WebApi2WithMVC
444442

445443
As alternatives, you could:
446444

447-
- Replace the only ExceptionHandler with a custom implementation of IExceptionHandler. This exception handler is only called when the framework is still able to choose which response message to send, not when the connection is aborted, for instance.
448-
- Use Exception Filters, as described in the preceding section on Web API 1.x controllers, which aren't called in all cases.
445+
- Replace the only `ExceptionHandler` instance with a custom implementation of `IExceptionHandler`. This exception handler is only called when the framework is still able to choose which response message to send, not when the connection is aborted, for instance.
446+
- Use exception filters, as described in the preceding section on Web API 1.x controllers, which aren't called in all cases.
449447

450448
## WCF
451449

452-
Add a class that extends Attribute and implements IErrorHandler and IServiceBehavior.
450+
Add a class that extends `Attribute` and implements `IErrorHandler` and `IServiceBehavior`.
453451

454452
```csharp
455453
using System;
@@ -521,11 +519,11 @@ namespace WcfService4
521519

522520
If you've [installed the Azure Monitor Application Insights Agent](./status-monitor-v2-overview.md) on your server, you can get a chart of the exceptions rate, measured by .NET. Both handled and unhandled .NET exceptions are included.
523521

524-
Open a metrics explorer tab, add a new chart, and under **Performance Counters**, select **Exception rate**.
522+
Open a metrics explorer tab, add a new chart. Under **Performance Counters**, select **Exception rate**.
525523

526-
The .NET framework calculates the rate by counting the number of exceptions in an interval and dividing by the length of the interval.
524+
The .NET Framework calculates the rate by counting the number of exceptions in an interval and dividing by the length of the interval.
527525

528-
This count is different from the Exceptions count calculated by the Application Insights portal counting TrackException reports. The sampling intervals are different, and the SDK doesn't send TrackException reports for all handled and unhandled exceptions.
526+
This count is different from the Exceptions count calculated by the Application Insights portal counting `TrackException` reports. The sampling intervals are different, and the SDK doesn't send `TrackException` reports for all handled and unhandled exceptions.
529527

530528
## Next steps
531529

0 commit comments

Comments
 (0)