You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/asp-net-exceptions.md
+16-18Lines changed: 16 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,15 +21,13 @@ You can set up Application Insights to report exceptions that occur in either th
21
21
22
22
To have exceptions reported from your server-side application, consider the following scenarios:
23
23
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.
29
27
30
28
### Client side
31
29
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).
33
31
34
32
### Application frameworks
35
33
@@ -48,7 +46,7 @@ With some application frameworks, more configuration is required. Consider the f
48
46
49
47
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.
50
48
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.
52
50
53
51

54
52
@@ -99,7 +97,7 @@ Request details don't include the data sent to your app in a POST call. To have
99
97
100
98
## <aname="exceptions"></a> Capture exceptions and related diagnostic data
101
99
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.
103
101
104
102
You can:
105
103
@@ -173,7 +171,7 @@ The properties and measurements parameters are optional, but they're useful for
173
171
174
172
Most browser exceptions are reported.
175
173
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.
177
175
178
176
## Reuse your telemetry client
179
177
@@ -325,11 +323,11 @@ There are several cases that the exception filters can't handle. For example:
325
323
* Exception thrown during application startup.
326
324
* Exception thrown in background tasks.
327
325
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.
329
327
330
328
### Prior versions support
331
329
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.
Add this snippet to the services in `WebApiConfig`:
415
413
416
414
```csharp
417
415
usingSystem.Web.Http;
@@ -444,12 +442,12 @@ namespace WebApi2WithMVC
444
442
445
443
As alternatives, you could:
446
444
447
-
- Replace the only ExceptionHandlerwith 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.
449
447
450
448
## WCF
451
449
452
-
Add a class that extends Attribute and implements IErrorHandler and IServiceBehavior.
450
+
Add a class that extends `Attribute` and implements `IErrorHandler` and `IServiceBehavior`.
453
451
454
452
```csharp
455
453
usingSystem;
@@ -521,11 +519,11 @@ namespace WcfService4
521
519
522
520
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.
523
521
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**.
525
523
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.
527
525
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.
0 commit comments