Skip to content

Commit 5f3ef06

Browse files
Merge pull request #10707 from MicrosoftDocs/main
Auto Publish – main to live - 2026-02-10 22:00 UTC
2 parents 29238ac + e7e51b6 commit 5f3ef06

1 file changed

Lines changed: 41 additions & 38 deletions

File tree

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,45 @@
11
---
22
title: Disable Debugging for ASP.NET Application
33
description: This article discusses how to disable debugging for ASP.NET applications.
4-
ms.date: 03/26/2025
4+
ms.date: 02/10/2026
55
ms.custom: sap:General Development
66
ms.topic: how-to
7-
ms.reviewer: paulboc
7+
ms.reviewer: paulboc, v-shaywood
88
---
99
# Disable debugging for ASP.NET applications
1010

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.
1212

1313
_Original product version:_   ASP.NET
1414
_Original KB number:_   815157
1515

1616
## Summary
1717

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.
1919

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.
2121

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.
2323

24-
## Method 1: Modify the Web.config file
24+
## Modify the Web.config file
2525

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.
2727

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.
3131

3232
The following code sample shows the compilation element with debug set to `false`:
3333

3434
```xml
3535
<compilation debug="false"/>
3636
```
3737

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.
3939

40-
## Method 2: Modify the Machine.config file
40+
## Use IIS Manager (if the web application is hosted on IIS)
4141

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:
43-
44-
1. Open the **Machine.config** file in a text editor, such as Notepad. The file is typically located in the following folder:
45-
46-
`%SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\`
47-
48-
For 64-bit versions of the .NET Framework, the file is in the following folder:
49-
50-
`%SystemRoot%\Microsoft.NET\Framework64\%VersionNumber%\CONFIG\`
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`.
54-
55-
The following code sample shows the compilation element with debug set to `false`:
56-
57-
```xml
58-
<compilation debug="false"/>
59-
```
60-
61-
1. Save the **Machine.config** file.
62-
63-
## Method 3: Using IIS Manager (if the web application is hosted on IIS)
64-
65-
1. Open IIS Manager on the computer where the website is hosted (you can select <kbd>Windows</kbd> + <kbd>R</kbd> and type **inetmgr**):
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**:
6643

6744
:::image type="content" source="media/disable-debugging-application/type-inetmgr-run-window.png" alt-text="Screenshot of typing inetmgr in the Run window.":::
6845

@@ -74,7 +51,7 @@ You can also disable debugging for all applications on a system by modifying the
7451

7552
:::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":::
7653

77-
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:
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:
7855

7956
- **True**: Enable debug mode.
8057
- **False**: Disable debug mode.
@@ -84,3 +61,29 @@ You can also disable debugging for all applications on a system by modifying the
8461
1. Select the **Apply** button from the right-hand side pane of IIS Manager to save the changes to the IIS configuration:
8562

8663
:::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":::
64+
65+
## Modify the Machine.config file
66+
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. To target only specific sites, prefer setting `debug="false"` in the application’s Web.config or via IIS Manager.
69+
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:
71+
72+
1. Open the `Machine.config` file in a text editor, such as Notepad. The file is typically located in the following folder:
73+
74+
`%SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\`
75+
76+
For 64-bit versions of the .NET Framework, the file is in the following folder:
77+
78+
`%SystemRoot%\Microsoft.NET\Framework64\%VersionNumber%\CONFIG\`
79+
80+
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`.
82+
83+
The following code sample shows the compilation element with debug set to `false`:
84+
85+
```xml
86+
<compilation debug="false"/>
87+
```
88+
89+
1. Save the `Machine.config` file.

0 commit comments

Comments
 (0)