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: support/developer/webapps/aspnet/development/disable-debugging-application.md
+39-38Lines changed: 39 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,85 +4,86 @@ description: This article discusses how to disable debugging for ASP.NET applica
4
4
ms.date: 03/26/2025
5
5
ms.custom: sap:General Development
6
6
ms.topic: how-to
7
-
ms.reviewer: paulboc
7
+
ms.reviewer: paulboc, v-shaywood
8
8
---
9
9
# Disable debugging for ASP.NET applications
10
10
11
-
This article discusses how to disable debugging for ASP.NET applications running on .NET Framework.
11
+
This article explains how to disable debugging for ASP.NET applications running on .NET Framework.
12
12
13
13
_Original product version:_ ASP.NET
14
14
_Original KB number:_ 815157
15
15
16
16
## Summary
17
17
18
-
ASP.NET supports compiling applications in a special debug mode that helps developer troubleshooting. Debug mode causes ASP.NET to compile applications with extra information. The information enables a debugger to closely monitor and control the execution of an application. Applications that are compiled in debug mode execute as expected. However, the performance of the application is affected. To avoid the effect on performance, it's a good idea to enable debugging only when a developer is doing interactive troubleshooting.
18
+
ASP.NET supports compiling applications in a special debug mode that helps developers troubleshoot. Debug mode causes ASP.NET to compile applications with extra information. The extra information enables a debugger to closely monitor and control the execution of an application. Applications that are compiled in debug mode execute as expected. However, the performance of the application is affected. To avoid the effect on performance, enable debugging only when a developer is doing interactive troubleshooting.
19
19
20
-
Debugging is disabled by default. Debugging is frequently enabled to troubleshoot a problem. But it's frequently not disabled after the problem is resolved. This article describes how to disable debugging for an ASP.NET application.
20
+
Debugging is disabled by default. Developers frequently enable debugging to troubleshoot a problem but don't disable it after the problem is resolved. This article describes how to disable debugging for an ASP.NET application.
21
21
22
-
To disable debugging, modify the **Web.config** file or the **Machine.config** file, as detailed in the following sections.
22
+
To disable debugging, modify the `Web.config` file or the `Machine.config` file, as detailed in the following sections.
23
23
24
-
## Method 1: Modify the Web.config file
24
+
## Modify the Web.config file
25
25
26
-
To disable debugging, add the compilation element to the **Web.config** file of the application by following these steps. The **Web.config** file is located in the application directory.
26
+
To disable debugging, add the compilation element to the `Web.config` file of the application by following these steps. The `Web.config` file is located in the application directory.
27
27
28
-
1. Open the **Web.config** file in a text editor, such as Notepad. The file is typically located in the application directory.
29
-
2. In the **Web.config** file, locate the compilation element. Debugging is enabled when the debug attribute in the compilation element is set to `true`.
30
-
3. Change the debug attribute to `false` to disable debugging for that application.
28
+
1. Open the `Web.config` file in a text editor, such as Notepad. The file is typically located in the application directory.
29
+
1. In the `Web.config` file, locate the compilation element. Debugging is enabled when the debug attribute in the compilation element is set to `true`.
30
+
1. Change the debug attribute to `false` to disable debugging for that application.
31
31
32
32
The following code sample shows the compilation element with debug set to `false`:
33
33
34
34
```xml
35
35
<compilationdebug="false"/>
36
36
```
37
37
38
-
4. Save the **Web.config** file. The ASP.NET application automatically restarts.
38
+
1. Save the `Web.config` file. The ASP.NET application automatically restarts.
39
39
40
-
## Method 2: Modify the Machine.config file
40
+
## Use IIS Manager (if the web application is hosted on IIS)
41
41
42
-
You can also disable debugging for all applications on a system by modifying the **Machine.config** file. To confirm that debugging isn't enabled in the **Machine.config** file, follow these steps:
42
+
1. Open IIS Manager on the computer where the website is hosted. You can select <kbd>Windows</kbd> + <kbd>R</kbd> and type **inetmgr**:
43
43
44
-
1. Open the **Machine.config** file in a text editor, such as Notepad. The file is typically located in the following folder:
44
+
:::image type="content" source="media/disable-debugging-application/type-inetmgr-run-window.png" alt-text="Screenshot of typing inetmgr in the Run window.":::
1. Select the website or web application for which you want to enable or disable debug mode from the left-hand side tree view:
47
47
48
-
For 64-bit versions of the .NET Framework, the file is in the following folder:
48
+
:::image type="content" source="media/disable-debugging-application/enable-disable-debug-mode-web-application.png" alt-text="Screenshot of website or web application for which you want to enable or disable debug mode." lightbox="media/disable-debugging-application/enable-disable-debug-mode-web-application.png":::
1. From the middle pane of IIS Manager, select the **.NET Compilation** icon:
51
51
52
-
1. In the **Machine.config** file, locate the compilation element. Debugging is enabled when the debug attribute in the compilation element is set to `true`.
53
-
1. If the debug attribute is `true`, change the debug attribute to `false`.
52
+
:::image type="content" source="media/disable-debugging-application/net-compilation-icon.png" alt-text="Screenshot of the .NET Compilation icon." lightbox="media/disable-debugging-application/net-compilation-icon.png":::
54
53
55
-
The following code sample shows the compilation element with debug set to `false`:
54
+
1. In the list of parameter values displayed in the middle pane of IIS Manager, set the value of **Debug** under the **Behavior** category to:
56
55
57
-
```xml
58
-
<compilationdebug="false"/>
59
-
```
56
+
- **True**: Enable debug mode.
57
+
- **False**: Disable debug mode.
60
58
61
-
1. Save the **Machine.config** file.
59
+
:::image type="content" source="media/disable-debugging-application/set-value-debug-under-behavior-category.png" alt-text="Screenshot of setting the value of Debug under the Behavior category." lightbox="media/disable-debugging-application/set-value-debug-under-behavior-category.png":::
62
60
63
-
**Caution**: Do not directly edit Machine.config unless you fully understand the impact. This file applies globally to all .NET applications on the server, and mistakes can break other applications. Prefer setting debug="false" in the application’s Web.config or via IIS Manager to target only specific sites.
61
+
1. Select the **Apply** button from the right-hand side pane of IIS Manager to save the changes to the IIS configuration:
64
62
65
-
## Method 3: Using IIS Manager (if the web application is hosted on IIS)
63
+
:::image type="content" source="media/disable-debugging-application/apply-button-iis-manager.png" alt-text="Screenshot of the Apply button in IIS Manager." lightbox="media/disable-debugging-application/apply-button-iis-manager.png":::
66
64
67
-
1. Open IIS Manager on the computer where the website is hosted (you can select <kbd>Windows</kbd> + <kbd>R</kbd> and type **inetmgr**):
65
+
## Modify the Machine.config file
68
66
69
-
:::image type="content" source="media/disable-debugging-application/type-inetmgr-run-window.png" alt-text="Screenshot of typing inetmgr in the Run window.":::
67
+
> [!CAUTION]
68
+
> Be careful when editing `Machine.config`. This file applies globally to all .NET applications on the server, and a misconfiguration can break other applications. Prefer setting `debug="false"` in the application’s Web.config or via IIS Manager to target only specific sites.
70
69
71
-
1. Select the website or web application for which you want to enable or disable debug mode from the left-hand side tree view:
70
+
You can also disable debugging for all applications on a system by modifying the `Machine.config` file. To confirm that debugging isn't enabled in the `Machine.config` file, follow these steps:
72
71
73
-
:::image type="content" source="media/disable-debugging-application/enable-disable-debug-mode-web-application.png" alt-text="Screenshot of website or web application for which you want to enable or disable debug mode." lightbox="media/disable-debugging-application/enable-disable-debug-mode-web-application.png":::
72
+
1. Open the `Machine.config` file in a text editor, such as Notepad. The file is typically located in the following folder:
74
73
75
-
1. From the middle pane of IIS Manager, select the **.NET Compilation** icon:
:::image type="content" source="media/disable-debugging-application/net-compilation-icon.png" alt-text="Screenshot of the .NET Compilation icon." lightbox="media/disable-debugging-application/net-compilation-icon.png":::
76
+
For 64-bit versions of the .NET Framework, the file is in the following folder:
78
77
79
-
1. Within the list of parameter values displayed in the middle pane of IIS Manager, set the value of **Debug** under the **Behavior** category to:
1. In the `Machine.config` file, locate the compilation element. Debugging is enabled when the debug attribute in the compilation element is set to `true`.
81
+
1. If the debug attribute is `true`, change the debug attribute to `false`.
83
82
84
-
:::image type="content" source="media/disable-debugging-application/set-value-debug-under-behavior-category.png" alt-text="Screenshot of setting the value of Debug under the Behavior category." lightbox="media/disable-debugging-application/set-value-debug-under-behavior-category.png":::
83
+
The following code sample shows the compilation element with debug set to `false`:
85
84
86
-
1. Select the **Apply** button from the right-hand side pane of IIS Manager to save the changes to the IIS configuration:
85
+
```xml
86
+
<compilationdebug="false"/>
87
+
```
87
88
88
-
:::image type="content" source="media/disable-debugging-application/apply-button-iis-manager.png" alt-text="Screenshot of the Apply button in IIS Manager." lightbox="media/disable-debugging-application/apply-button-iis-manager.png":::
0 commit comments