Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: "Access Is Denied" Error Message When You Use System.Diagnostics.Debugger.Break in an ASP.NET Application


View products that this article applies to.

Symptoms

When you use the System.Diagnostics.Debugger.Break method to invoke a just-in-time (JIT) debugging window in an ASP.NET application, you may receive the following error message:
JIT Debugging failed with the following error: Access is denied.
JIT Debugging was initiated by the user account 'ServerName\ASPNET'.
Check the documentation index for 'Just-in-time debugging, errors' for more information.
Note ServerName is the name of your Web server.

↑ Back to the top


Cause

By default, the ASP.NET worker process runs under the ASPNET user account. This ASPNET account does not have the user right to invoke JIT by using the System.Diagnostics.Debugger.Break method unless the account is added to the Debugging Users group.

↑ Back to the top


Resolution

To resolve this problem, add the ASPNET user account to the Debugger Users group or run the ASP.NET worker process under another user account that has debugging rights.

To add the ASPNET user account to the Debugger Users group, follow these steps:
  1. Click Start, point to Programs, point to Administrative Tools, and then click Computer Management.
  2. In Computer Management, expand System Tools, expand Local Users and Groups, and then expand Groups.
  3. Double-click Debugger Users.
  4. In the Debugger Users Properties dialog box, click Add.
  5. In the Select Users or Groups dialog box, type ServerName\ASPNET in the text box, and then click OK two times.
  6. Close the Computer Management tool.
  7. Create an ASP.NET Web Application project, as explained in the steps 1 through 4 of the "More Information" section.
  8. Type the following URL in the browser:
    http://ServerName/JitTest/WebForm1.aspx
    Note ServerName is name of the Web server.

    Verify that the expected JIT window is invoked.
Important By adding users to the Debugger Users group, you might create a security risk because you are allowing those users to gain access to your computer. Only add those users who must have debugger access on that specific computer. It is not a good idea to add Everyone to the Debugger Users group.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


More information

Steps to Reproduce the Behavior

  1. In Microsoft Visual Studio .NET, create a new ASP.NET Web Application project by using Visual Basic .NET or Visual C# .NET. Name the project JitTest. By default, WebForm1.aspx is created.
  2. Right-click WebForm1.aspx, and then click View Code.
  3. Modify the Page_Load event as follows :

    Visual C# .NET Sample Code
    private void Page_Load(object sender, System.EventArgs e)
    {
     System.Diagnostics.Debugger.Break();
    }
    Visual Basic .NET Sample Code
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      System.Diagnostics.Debugger.Break()
    End Sub
  4. On the Build menu, click Build Solution.
  5. Type the following URL in the browser:
    http://ServerName/JitTest/WebForm1.aspx

↑ Back to the top


References

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
318041� HOW TO: Set Up and Use Remote Debugging in Microsoft Visual Studio .NET
For more information, visit the following Microsoft Web site:

↑ Back to the top


Keywords: KB817035, kbprb, kbwebforms, kbdebug, kbjit, kberrmsg

↑ Back to the top

Article Info
Article ID : 817035
Revision : 5
Created on : 4/29/2007
Published on : 4/29/2007
Exists online : False
Views : 349