Microsoft KB Archive/817034

= PRB: &quot;Unable to Start Debugging on the Web Server&quot; Error Message While You Debug ASP.NET Applications =

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
 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. Right-click WebForm1.aspx, and then click View Code.  Change the Page_Load event as follows :

Visual C# .NET Code
private void Page_Load(object sender, System.EventArgs e) { Response.Write(&quot;Hi&quot;); }

Visual Basic .NET Code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.Write(&quot;Hi&quot;) End Sub  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
 Set a breakpoint on the code in the Page_Load event. 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.</li> On the Debug menu, click Processes.</li> In the Processes dialog box, select the Aspnet_wp.exe process under Available Processes, and then click Attach.</li> In the Attach to Process dialog box, click to select the Native and the Common Language Runtime check boxes.</li> Click OK, and then click Close.

Note When you click OK, Visual Studio .NET may take 2 to 5 minutes to attach the process.</li> Type the following URL in the browser:

http://localhost/DebugTest/WebForm1.aspx

</li> Type your User Name and Password in the dialog box, and then click OK.</li> Verify that you hit the breakpoint as you expect.</li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

Create an ASP.NET Web Application Project
 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.</li> Right-click WebForm1.aspx, and then click View Code .</li>  Change the Page_Load event as follows :

Visual C# .NET Code
private void Page_Load(object sender, System.EventArgs e) { Response.Write(&quot;Hi&quot;); }

Visual Basic .NET Code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Response.Write(&quot;Hi&quot;) End Sub </li> On Build menu, click Build Solution.</li></ol>

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 &quot;Symptoms&quot; section.

<div class="references_section">