Symptoms that are exhibited when you use Visual Studio .NET to debug ASP.NET
When you debug an ASP.NET application in Microsoft Visual Studio
.NET, you may receive the following error message in the IDE:
Error while trying to run project: Unable to start
debugging on the Web server. The server does not support debugging of ASP.NET
or ATL Server applications. Run setup to install the Visual Studio .NET server
components. If setup has been run, verify that a valid URL has been specified.
You may also want to refer to the ASP.NET and ATL Server debugging
topic in the online documentation. Would you like to disable future attempts to
debug ASP.NET pages for this project?
After you install the Microsoft .NET Framework Software
Development Kit (SDK) or Microsoft Visual Studio .NET, Microsoft Internet
Information Services (IIS) mappings are created to associate new file name
extensions and new settings for ASP.NET.
The new settings are not in
place if either of the following statements applies to your situation:
IIS was not installed when you ran the .NET Framework SDK
or Visual Studio .NET Setup.
You removed and then reinstalled IIS after you ran the .NET
Framework SDK Setup or the Visual Studio .NET Setup.
To resolve this issue, repair the IIS mappings so that the
file name extensions for ASP.NET are properly associated. There are two ways to
fix IIS mappings for ASP.NET.
To repair IIS mappings for ASP.NET, run
the Aspnet_regiis.exe utlity. To do so, follow these steps:
Click Start, and then click Run.
Type cmd, and then click OK.
At the command prompt, type the following command, and then
press ENTER:
Note Replace
WindowsFolder with the name of the directory where the operating system is
installed. Replace VersionNumber with the .NET Framework version installed on your computer.
To repair IIS mappings for ASP.NET, you must register
Aspnet_isapi.dll. To do so, follow these steps:
Click Start, and then click Run.
Type regsvr32 WindowsFolder\Microsoft.NET\Framework\VersionNumber\aspnet_isapi.dll, and then
click OK. Regsvr32 returns the results of the registration.
Follow these steps to verify whether or not you see the issue
described in this article. This test checks for the typical symptoms that are
related to the issue. If you are already familiar with how IIS application
mappings work, you can also follow the steps in the "How To Verify Your IIS
Application Mappings" section of this article to verify the configuration of
your Web server.
To create an ASP.NET Web application, use Visual Studio
.NET. To do so, follow these steps:
Start Microsoft Visual Studio .NET.
On the File menu, point to New, and then click Project.
In the New Project dialog box, click either Visual C# Projects or Visual Basic Projects under Project Types, and then click ASP.NET Web Application under Templates.
In the Location box, replace the WebApplication# default name with MyWebApp. If you use the
local server, you can leave the server name as http://localhost. The resulting Location box appears as follows:
http://localhost/MyWebApp
In Solution Explorer right-click the project node, point to
Add, and then click Add Web Form. Name the Web Form MappingsTest.aspx, and
then click Open.
Right-click the .aspx page in the editor, and then click View Code. Add the following code to the Page_Load event handler:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Response.Write("This code was executed")
End Sub
On the File menu, click Save All to save the Web Form and other associated project files.
On the Build menu in the Visual Studio .NET IDE, click Build Solution.
Right-click the .aspx page, and then click View in Browser.
If the mappings are correct, the "This code was executed"
message appears in the browser. If the mappings are not correct, one of the
following behaviors occurs:
A blank page appears in the browser.
You receive a prompt to download the .aspx
page.
This behavior occurs because server-side code is not
processed or executed in the expected manner. In either case you receive the
unprocessed source code. For the blank page scenario, if you right-click the
page in the browser and then click View Source, you notice that the server-side code appears in its unprocessed
form. For example, in a Visual C# ASP.NET Web Form, the @ Page directive appears similar to the following:
Note
Replace WindowsFolder with the name of the directory where the operating system is
installed. Replace VersionNumber with the .NET Framework version that is installed on your computer.
If you cannot find the application mapping entry, follow
the steps in the "Resolution" section of this article.
The resolution to repair IIS mappings for ASP.NET is
derived from Microsoft Knowledge Base article Q306005.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
306005
(http://support.microsoft.com/kb/306005/
)
How to repair IIS mapping after you remove and reinstall IIS
The following article offers more in-depth
information about the debugging scenario described previously in this document:
318465
(http://support.microsoft.com/kb/318465/
)
Cannot debug ASP.NET Web application