Microsoft KB Archive/817034

From BetaArchive Wiki

Article ID: 817034

Article Last Modified on 4/29/2007



APPLIES TO

  • Microsoft ASP.NET 1.0
  • Microsoft ASP.NET 1.1



SYMPTOMS

You create an ASP.NET Web application and then specify that the authentication in Internet Information Services (IIS) is set to Basic authentication. When you try to start to debug the ASP.NET Web application project in Visual Studio .NET, you may receive the following error message:


Error while trying to run project: Unable to start debugging on the Web server. You do not have permissions to debug the server.
Verify that you are a member of the Debugger Users group on the server. Would you like to disable future attempts to debug ASP.NET pages for this project?

CAUSE

When you set authentication to Basic, the HTTP debug request cannot establish the username and the password for the debugger. Therefore, the request does not reach the ASP.NET source code to debug, and then the auto-attach debugging of processes fails.


WORKAROUND

To work around this problem, manually attach a debugger process. You can debug an ASP.NET Web application even if you set the authentication to Basic. Follow these steps to attach an Aspnet_wp.exe process to debug an ASP.NET Web application.

Create an ASP.NET Web Application Project

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

    Visual C# .NET Code

    private void Page_Load(object sender, System.EventArgs e)
    {
     Response.Write("Hi");
    }


    Visual Basic .NET Code


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Response.Write("Hi")
    End Sub
  4. On the Build menu, click Build Solution.

Set Authentication to Basic

  1. Click Start, point to Settings, and then click Control Panel.
  2. In Control Panel, double-click Administrative Tools.
  3. Double-click Internet Information Services.
  4. Expand Internet Information Services, and then locate the DebugTest virtual directory.
  5. Right-click DebugTest, and then click Properties.
  6. Click the Directory Security tab. Under Anonymous access and authentication control, click Edit.
  7. In the Authentication Methods dialog box, click to select the Basic authentication check box.
  8. Click to clear the Anonymous access check box. Click to clear the Integrated Windows authentication check box.
  9. Click OK.

Attach aspnet_wp process to Debug

  1. Set a breakpoint on the code in the Page_Load event.
  2. On the Debug menu, click Start Without Debugging.
    Note You must use the Start Without Debugging option to see the ASP.NET worker process start.
  3. On the Debug menu, click Processes.
  4. In the Processes dialog box, select the Aspnet_wp.exe process under Available Processes, and then click Attach.
  5. In the Attach to Process dialog box, click to select the Native and the Common Language Runtime check boxes.
  6. Click OK, and then click Close.
    Note When you click OK, Visual Studio .NET may take 2 to 5 minutes to attach the process.
  7. Type the following URL in the browser:
  8. Type your User Name and Password in the dialog box, and then click OK.
  9. Verify that you hit the breakpoint as you expect.


STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior


Create an ASP.NET Web Application Project

  1. In Microsoft Visual Studio .NET, use Visual Basic .NET or Visual C# .NET to create a new ASP.NET Web application. Name the Project DebugTest. By default, WebForm1.aspx is created.
  2. Right-click WebForm1.aspx, and then click View Code .
  3. Change the Page_Load event as follows :

    Visual C# .NET Code

    private void Page_Load(object sender, System.EventArgs e)
    {
     Response.Write("Hi");
    }


    Visual Basic .NET Code


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Response.Write("Hi")
    End Sub
  4. On Build menu, click Build Solution.

Set Authentication to Basic

  1. Click Start, point to Settings, and then click Control Panel.
  2. In Control Panel, double-click Administrative Tools.
  3. Double-click Internet Information Services.
  4. Expand Internet Information Services, and then locate the DebugTest virtual directory.
  5. Right-click DebugTest, and then click Properties.
  6. Click the Directory Security tab. Under Anonymous access and authentication control, click Edit.
  7. In the Authentication Methods dialog box, click to select the Basic authentication check box.
  8. Click to clear the Anonymous access check box. Click to clear the Integrated Windows authentication check box.
  9. Click OK, and then click OK again.

Debug the Project

  1. Set the breakpoint on the code in the Page_Load event.
  2. On the Debug menu, click Start.
  3. You receive the error message that is described in the "Symptoms" section.


REFERENCES


For more information about how to debug ASP.NET, visit the following Microsoft Developer Network Web site:

Debugging ASP.NET Web Applications
http://msdn2.microsoft.com/en-us/library/w2faa92k(vs.71).aspx

For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:

306172 INFO: Common Errors When You Debug ASP.NET Applications in Visual Studio .NET


318041 HOW TO: Set Up and Use Remote Debugging in Microsoft Visual Studio .NET



306169 PRB: Visual Studio .NET Debugger Does Not Stop on Breakpoints When You Debug ASP.NET Pages


Keywords: kbdebug kbauthentication kberrmsg kbwebforms kbprb KB817034