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.

Creating and opening ASP.NET projects in Visual Studio .NET


View products that this article applies to.

Introduction

Welcome to the ASP.NET Support Voice column! My name is Jerry Orman. I have been with Microsoft over 5 years, and have spent most of my time focused on Web-related technologies such as Microsoft FrontPage and the new Microsoft SharePoint technologies. I have spent the last year working with Microsoft ASP.NET as a support engineer. This month in the Support Voice column, I am going to describe creating and opening ASP.NET projects in Microsoft Visual Studio .NET.

While troubleshooting an issue in which I am unable to open or create ASP.NET-based projects, I've found that it is very important to understand what Visual Studio .NET is doing in the background to help isolate the issue. As you'll see below, this process has multiple steps and is very dependent on Microsoft Internet Information Services (IIS) functioning correctly on the back end. I will include the error messages and dialog boxes you will see along the way as well as recommended steps to narrow down the problem.

File path versus FrontPage Server Extensions

In Microsoft Visual Studio .NET 2003, there are two methods for creating and opening Web sites. One method uses a file path to copy files, and the other method uses Microsoft FrontPage Server Extensions. Each method has pros and cons. Below is a table outlining the differences.

FrontPage Server Extensions
ProCon
Remotely administer and manipulate a Web site over HTTP. If you have multiple URLs that you work against, this method is preferable.

Visual Studio .NET creates the folder and files, and sets the application settings in IIS by sending Web Extender Client (WEC) based RPC calls to the FrontPage Server Extensions over HTTP.
- Admin help for FrontPage Server Extensions:Don't need to be an admin on the computer you are administering. You need to be an Administrator in FrontPage Server Extensions permissions, which allows you to manage and manipulate the contents of that FrontPage Server Extensions extended site, while preventing you from actually making operating system-level changes.
FrontPage Server Extensions sets NTFS permissions when configured.

Adds folders starting with _vti to manage the content.

Troubleshooting FrontPage Server Extensions and problems related to them can be difficult.
File path
ProCon
Typically easier to configure.

Uses a file share to connect to the remote server. By default, this path is \\server\wwwroot$. You can install Remote Components to set up the share or manually create it.

Uses SMB to create the folder and copy the files.
Need to be able to connect to a UNC path for this to work. Will not work over HTTP.

Account running Visual Studio .NET needs to be an admin on the remote computer because this method uses ADSI to set the application root in IIS.

If authoring against multiple URLs, you will need to keep up with all the shares.

Changing the method used to create projects

By default, Visual Studio .NET uses the file share method. If you want to always use the FrontPage Server Extensions method by default, you can change this setting by following the steps below:
  1. Start Visual Studio .NET 2003.
  2. On the Tools menu, click Options.
  3. Expand Projects.
  4. Click Web Settings.
  5. Click FrontPage Extensions.

    Note The option for Repair links when Web files are moved or renamed can be left unchecked. FrontPage Server Extensions can update hyperlinks to resources if you move a file to a subfolder.
  6. Click OK.

Creating an ASP.NET project

When you create a project, the behavior is similar regardless of the method you use. In general, the following will occur:
  1. A folder is created to hold the application and is marked as an application in IIS.
  2. The version of the framework is verified.
  3. Whether files can be copied and browsed from the URL provided is verified.
  4. Template files are copied to the site.

A folder is created and marked as an application

When using the file share method, a folder is created at the UNC path \\server\wwwroot$\application. If you are working locally, the IDE will get the local path for the Web site from the IIS metabase and uses the local path instead of the UNC path. The folder is then marked as an application in IIS by using ADSI. This process requires you to be an administrator on the computer you are creating the project on. If you don't have access to the share or the share does not exist, you will get the following message:
When you get this message, you should try to open the UNC path in Microsoft Windows and confirm that your account can access the share and create a folder. If you can get to the share, but the folder cannot be marked as an application because you are not an administrator, you will see the following message:
You will get this message even if the folder is already marked as an application in IIS. This is because your user account does not have enough privileges to check the application setting in IIS. If you want to develop as a non-administrator, an administrator will need to create the folder that will host your application and set the folder as an application in IIS. When using the FrontPage Server Extensions method, this entire process is done by using WEC. This is the same technology that Microsoft Visual Interdev 6.0 and the FrontPage client use to connect to and manipulate Web sites. The folder is created and marked as an application by sending RPC calls through HTTP POST requests to the FrontPage Server Extension DLLs. If you do not have permissions to use the FrontPage Server Extensions, you will get prompted to log in:
If your login fails, you will get the following failure message:
Regardless of which method you use, if you selected a project name that already exists, you will see the following dialog box allowing you to change the project name:

The version of the framework is verified

Once the IDE creates the folder, it verifies that the correct version of the framework is configured. This is done by sending a request for the get_aspx_ver.aspx file. The path of the request will be applicationPath/get_aspx_ver.aspx. This file doesn't exist and the IDE is expecting the ASP.NET 404 message to be returned. The IDE uses this error page to get the version number listed at the bottom. In this case the version is 1.1.4322.2300. This is the version for the Microsoft .NET Framework 1.1, which is included with Microsoft Windows Server 2003 Service Pack 1 (SP1).
If this page is not returned, you get the following message stating that the .NET Framework 1.1 was not detected:
The most common causes for the 404 page not being returned are that some component is redirecting the request for get_aspx_ver.aspx, a custom error page is configured in the Machine.config file, ASP.NET is not configured in the IIS Mappings, or ASP.NET is prohibited in the IIS Web Service Extensions if you are using IIS 6.0.

Check the IIS Mappings:
  1. Open Internet Information Services Manager.
  2. Right-click the Web site you are creating the project against, and then click Properties.
  3. Click the Home Directory tab.
  4. Under Application Settings, click Configure.
  5. On the Application Mappings tab, make sure that .aspx is listed and that it is pointing to the Aspnet_isapi.dll file.
  6. If the mapping is missing, run aspnet_regiis �I from the framework folder:
    %windir%\Microsoft.NET\Framework\v1.1.4322
Make sure that ASP.NET is enabled (only applies for IIS 6.0):
  1. Open Internet Information Services Manager.
  2. Select Web Service Extensions Folder.
  3. Right-click ASP.NET v1.1.4322, select Allowed.
Note If ASP.NET v1.1.4322 is missing, run aspnet_regiis �I from the framework folder:
%windir%\Microsoft.NET\Framework\v1.1.4322
If there is an error getting to the page, you will get an error stating an HTTP exception similar to the following:


When you see this type of error, you want to create an empty text file and name it test.aspx in the site and then try to browse. If that fails or throws an error, you need to troubleshoot browsing .aspx pages from the Web server. You will not be able to create a project if you can't browse an .aspx page.

Tip A 403 response in this scenario is typically caused by Execute Permissions being set to None or Read being unchecked.
  1. Open Internet Information Services Manager.
  2. Right-click the Web site you are creating the project against, and then click Properties.
  3. Click the Home Directory tab.
  4. Make sure that the Read permission is checked.
  5. Make sure that the Execute permission is set to Scripts Only.

The vs-####_tmp.htm file

Once the folder is created and the version of the framework is confirmed, the IDE copies an .htm file to the folder. The file is then browsed using the URL used to create the site. This is done to ensure that the folder the IDE is using can be browsed using the URL. The file will have a name similar to vs11062107329733631_tmp.htm. The number will always be different. When the IDE requests the file, it has to be the EXACT same file as was copied into the directory. If something intercepts the request and modifies the output or the page is not returned, you will see the following dialog box. The same dialog box is returned whether you are using FrontPage Server Extensions or file share. The only difference is the option that is selected.
Once you get this dialog box, make a note of the file share, the URL, and the details of the error. In this case, the file share is \\remoteserver\c$\inetpub\supportsite, the URL is http://remoteserver/webapplication1, and the error is an HTTP 404 error. If you look in the IIS log after getting this error, you will see something similar to:

16:21:25 127.0.0.1 GET /WebApplication1/vs11062107329733631_tmp.htm 404

The 404 is a File Not Found response code. This code indicates that once the IDE made the request using the URL, the file didn't exist. Typically, this problem is due to the share path not pointing to the location that the IIS Web server is using to serve content. The next step is to copy a test HTML file into the share listed in the error and browse the file using the URL. If this fails, you need to investigate the permissions on the share and check the properties for your IIS Web site that maps to the URL to make sure that the local path matches the folder that is shared.

Check the file path IIS is using:
  1. Open Internet Information Services Manager.
  2. Right-click the Web site you are creating the project against, and then click Properties.
  3. Click the Home Directory tab.
  4. The local path is the location the application folder should be created in.

Copy template files into the site folder

Once all the above checks are completed, the template files are copied into the folder and displayed in Solution Explorer. If you are using FrontPage Server Extensions to create the site, you will see the following dialog box while this occurs:

Troubleshooting creating ASP.NET applications

Now that we can see how dependent this process is on IIS and the configuration being a specific way, the first place you'll want to check is the IIS logs. Along with the above dialog boxes and information, this will help you to determine which step isn't working. The IIS logs are in the following location:
%windir%\system32\logfiles\w3svc#
Note # is the IIS Instance number of the Web site.

Tip You can also go to Start, click Run, and type LogFiles to get to the default log file directory.

You can get the path by checking the IIS Properties:
  1. Open Internet Information Services Manager.
  2. Right-click the Web site you are creating projects against, and then click Properties.
  3. On the Web Site tab, click Properties under Enable Logging.
  4. The Log File Path and Directory are listed at the bottom of the General Properties tab.
When you are looking at the log file, it's good to know what they should look like when the process works. The following are examples of creating a project using both the file share and FrontPage Server Extensions. I've added comments in the log to show the items you're after. As mentioned above, if you don't get the expected response code, you will see the dialog boxes displayed above.
#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2005-08-30 20:35:33
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status 

The GET request for get_aspx_ver.aspx � notice the response is a 404 File Not Found.  This is the expected response.
2005-08-30 20:35:33 65.53.73.163 GET /supportvoice3/get_aspx_ver.aspx - 80 - 65.53.75.132 Microsoft-Visual-Studio.NET/7.10.3077 404 0 0

Here is the GET request for the vs###_tmp.htm file.  The expected response for this is a 200.
2005-08-30 20:35:33 65.53.73.163 GET /supportvoice3/vs158849317529732258_tmp.htm - 80 - 65.53.75.132 Microsoft-Visual-Studio.NET/7.10.3077 200 0 0

These are requests for FrontPage Server Extensions files.  Even though you specified file share mode, if the FrontPage Server Extensions are on the site, the IDE will still look for them and try to use them if possible. On this site, the FrontPage Server Extensions are not configured, so all these requests return 404 messages. You won't see anything related to the actual project files because they are all copied over SMB, which is not handled by IIS.
2005-08-30 20:35:33 65.53.73.163 GET /_vti_inf.html - 80 - 65.53.75.132 Mozilla/2.0+(compatible;+MS+FrontPage+4.0) 404 0 2
2005-08-30 20:35:33 65.53.73.163 POST /supportvoice3/_vti_bin/shtml.exe/_vti_rpc - 80 - 65.53.75.132 MSFrontPage/4.0 404 0 3
2005-08-30 20:35:33 65.53.73.163 GET /_vti_inf.html - 80 - 65.53.75.132 Mozilla/2.0+(compatible;+MS+FrontPage+4.0) 404 0 2
2005-08-30 20:35:33 65.53.73.163 POST /_vti_bin/shtml.exe/_vti_rpc - 80 - 65.53.75.132 MSFrontPage/4.0 404 0 3
2005-08-30 20:35:33 65.53.73.163 GET /_vti_inf.html - 80 - 65.53.75.132 Mozilla/2.0+(compatible;+MS+FrontPage+4.0) 404 0 2
2005-08-30 20:35:33 65.53.73.163 POST /_vti_bin/shtml.exe/_vti_rpc - 80 - 65.53.75.132 MSFrontPage/4.0 404 0 3
2005-08-30 20:35:33 65.53.73.163 GET /_vti_inf.html - 80 - 65.53.75.132 Mozilla/2.0+(compatible;+MS+FrontPage+4.0) 404 0 2
2005-08-30 20:35:33 65.53.73.163 POST /_vti_bin/shtml.exe/_vti_rpc - 80 - 65.53.75.132 MSFrontPage/4.0 404 0 3
2005-08-30 20:35:33 65.53.73.163 GET /supportvoice3/get_aspx_ver.aspx - 80 - 65.53.75.132 Microsoft-Visual-Studio.NET/7.10.3077 404 0 0
Now that we've seen what an IIS log looks like for a successful project creation using the file share mode, let's take a look at a log using FrontPage Server Extensions to create the project. I've again added some comments to help out:
#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2005-08-30 20:42:40
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status 

The GET request for get_aspx_ver.aspx � notice the response is a 404 File Not Found.  This is the expected response.
2005-08-30 20:42:40 65.53.73.163 GET /supportvoice/get_aspx_ver.aspx - 9999 - 65.53.75.132 Microsoft-Visual-Studio.NET/7.10.3077 404 0 0

Here is the GET request for the vs###_tmp.htm file.  The expected response for this is a 200.
2005-08-30 20:42:52 65.53.73.163 GET /supportvoice/vs168727587929732259_tmp.htm - 9999 - 65.53.75.132 Microsoft-Visual-Studio.NET/7.10.3077 200 0 0

You'll now see requests looking for the author.dll file.  This first request looks for the file in a _vti_bin folder inside the application folder. This is for backward compatibility. The file was moved into the _vti_bin folder in the root of the Web site as of the 2000 version of the FrontPage Server Extensions.
2005-08-30 20:42:52 65.53.73.163 POST /supportvoice/_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/4.0 404 0 3

Now the IDE is looking in the _vti_bin folder in the root of the Web site. The IDE finds the shtml.dll file (it returned a 200), so the IDE starts sending POST requests to the author.dll file to copy the files for the ASP.NET project to the Web site. You can run a network monitor trace and look in the body of the POST to author.dll to see the FrontPage RPC calls that are made.
2005-08-30 20:42:52 65.53.73.163 POST /_vti_bin/shtml.dll/_vti_rpc - 9999 - 65.53.75.132 MSFrontPage/4.0 200 0 0
2005-08-30 20:42:52 65.53.73.163 POST /_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/4.0 200 5 0
2005-08-30 20:42:52 65.53.73.163 POST /_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/4.0 401 1 0
2005-08-30 20:42:54 65.53.73.163 POST /_vti_bin/_vti_aut/author.dll - 9999 DOMAIN\user 65.53.75.132 MSFrontPage/4.0 200 0 0
2005-08-30 20:42:54 65.53.73.163 POST /_vti_bin/_vti_adm/admin.dll - 9999 - 65.53.75.132 MSFrontPage/4.0 200 5 0
2005-08-30 20:42:54 65.53.73.163 POST /_vti_bin/_vti_adm/admin.dll - 9999 - 65.53.75.132 MSFrontPage/4.0 401 1 0

Opening existing projects

When opening projects in the Visual Studio .NET IDE, you get two options on the File menu, Open Project and Open Project From Web. If you want to open the project using the file share method, you use Open Project. If you want to use FrontPage Server Extensions, you use Open Project From Web.

Open Project

When you select Open Project, the Open Project dialog box opens and you navigate to the .vbproj or .csproj file associated with your ASP.NET application. When you open the project file, the IDE uses the .webinfo file located in the same folder to match the file path you selected with the URL listed in the .webinfo file.

The .webinfo file contains the following information pointing to the project file by using a URL:
<VisualStudioUNCWeb>
    <Web URLPath = "http://<RemoteServer>/SupportVoice/SupportVoice.csproj" />
</VisualStudioUNCWeb>
The URL listed is the URL specified when the project was first created. The validation done here is the same as that used to create a new project. Visual Studio .NET copies a file to the file path you used to open the project named vs###_tmp.htm and then browses the file using the URL in the .webinfo file. In this case, if the request to the .htm file fails, you will get the following message:
Unable to open Web project 'SupportVoice'. The file path '\\server\share\supportvoice' does not correspond to the URL 'http://server/wrongpath'. The two need to map to the same server location. HTTP Error 404: Not Found
Notice the URL is /wrongpath and not /supportvoice. This indicates the .webinfo has the incorrect URL.

The IIS log will show the following entry:

2005-08-30 20:48:12 65.53.73.163 GET /wrongpath/vs59855858329732260_tmp.htm - 9999 - 65.53.75.132 Microsoft-Visual-Studio.NET/7.10.3077 404 0 3

If you need to troubleshoot opening a project using file share, the following IIS log shows what the process looks like when it works. I've again added some comments to help you out:
#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2005-08-30 20:33:49
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status 

GET for the vs###_tmp.htm.  The response is a 200, which is the correct response. If you have any other response, you need to check the .webinfo file and make sure that the file path you used for the project file matches the URL in the .webinfo file.
2005-08-30 20:33:49 65.53.73.163 GET /SupportVoice/vs51193067529732258_tmp.htm - 80 - 65.53.75.132 Microsoft-Visual-Studio.NET/7.10.3077 200 0 0

Requests looking for FrontPage Server Extensions to see if they are configured. Notice that these are all 404 File Not Found in this case.
2005-08-30 20:33:49 65.53.73.163 GET /_vti_inf.html - 80 - 65.53.75.132 Mozilla/2.0+(compatible;+MS+FrontPage+4.0) 404 0 2
2005-08-30 20:33:49 65.53.73.163 POST /SupportVoice/_vti_bin/shtml.exe/_vti_rpc - 80 - 65.53.75.132 MSFrontPage/4.0 404 0 3
2005-08-30 20:33:49 65.53.73.163 GET /_vti_inf.html - 80 - 65.53.75.132 Mozilla/2.0+(compatible;+MS+FrontPage+4.0) 404 0 2
2005-08-30 20:33:49 65.53.73.163 POST /_vti_bin/shtml.exe/_vti_rpc - 80 - 65.53.75.132 MSFrontPage/4.0 404 0 3

GET request for the get_aspx_ver.aspx page. The expected response is a 404.
2005-08-30 20:33:52 65.53.73.163 GET /SupportVoice/get_aspx_ver.aspx - 80 - 65.53.75.132 Microsoft-Visual-Studio.NET/7.10.3077 404 0 0

Open Project From Web

If you select Open Project From Web, you are using FrontPage Server Extensions. This method does not use the file path and is done completely over HTTP. From the beginning, you'll notice that you are asked for the URL of the site instead of the file path of the project file. This method also does not use the .webinfo file because the IDE does not need to validate that the file share is the same as the Web site.
Once you enter a URL and click OK, the client uses WEC to display a list of the applications on the server. This list is obtained by using FrontPage RPC calls to the server. The dialog box should look like the following:
You can double-click the application you want to open and then double-click the project file to open the project:
If the server does not have FrontPage Server Extensions, you will get directed to your My Document folder:
You could potentially also see an empty Web site like the following:
The empty Open Project dialog box can occur when the Web server returns a header stating that the server supports Distributed Authoring and Versioning (DAV) instead of the headers for WEC. By default, Directory Browsing is not allowed in IIS. So when the client makes the DAV request to the folder, IIS does not return the list of files. You can work around this problem by enabling Directory Browsing on the content so that DAV will list the contents. Another option is to use the solutions in the following Microsoft Knowledge Base article:
304133 Errors appear if you use an Office XP program to save content
The following IIS log shows the IDE opening a project by using FrontPage Server Extensions. Notice there is not a request for the get_aspx_ver.aspx file or for the vs###_tmp.htm file. All the requests are being sent through the DLLs in the _vti_bin folder.
#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2005-08-30 20:44:41
#Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status 
2005-08-30 20:44:41 65.53.73.163 OPTIONS / - 9999 - 65.53.75.132 Microsoft+Data+Access+Internet+Publishing+Provider+Protocol+Discovery 200 0 0
2005-08-30 20:44:41 65.53.73.163 GET /_vti_inf.html - 9999 - 65.53.75.132 Mozilla/4.0+(compatible;+MS+FrontPage+6.0) 200 0 0
2005-08-30 20:44:41 65.53.73.163 POST /_vti_bin/shtml.dll/_vti_rpc - 9999 - 65.53.75.132 MSFrontPage/6.0 200 0 0
2005-08-30 20:44:41 65.53.73.163 POST /_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/6.0 200 5 0
2005-08-30 20:44:41 65.53.73.163 POST /_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/6.0 401 1 0
2005-08-30 20:44:42 65.53.73.163 POST /_vti_bin/_vti_aut/author.dll - 9999 DOMAIN\user 65.53.75.132 MSFrontPage/6.0 200 0 0
2005-08-30 20:44:42 65.53.73.163 OPTIONS / - 9999 - 65.53.75.132 Microsoft+Data+Access+Internet+Publishing+Provider+Protocol+Discovery 200 0 0
2005-08-30 20:44:42 65.53.73.163 POST /_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/6.0 401 1 0
2005-08-30 20:44:42 65.53.73.163 POST /_vti_bin/_vti_aut/author.dll - 9999 DOMAIN\user 65.53.75.132 MSFrontPage/6.0 200 0 0
2005-08-30 20:44:46 65.53.73.163 OPTIONS / - 9999 - 65.53.75.132 Microsoft+Data+Access+Internet+Publishing+Provider+Protocol+Discovery 200 0 0
2005-08-30 20:44:46 65.53.73.163 OPTIONS /supportvoice - 9999 - 65.53.75.132 Microsoft+Data+Access+Internet+Publishing+Provider+Protocol+Discovery 200 0 0
2005-08-30 20:44:46 65.53.73.163 POST /supportvoice/_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/6.0 200 5 0
2005-08-30 20:44:46 65.53.73.163 POST /supportvoice/_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/6.0 401 1 0
2005-08-30 20:44:46 65.53.73.163 POST /supportvoice/_vti_bin/_vti_aut/author.dll - 9999 DOMAIN\user 65.53.75.132 MSFrontPage/6.0 200 0 0
2005-08-30 20:44:46 65.53.73.163 POST /supportvoice/_vti_bin/_vti_aut/author.dll - 9999 - 65.53.75.132 MSFrontPage/6.0 401 1 0
2005-08-30 20:44:46 65.53.73.163 POST /supportvoice/_vti_bin/_vti_aut/author.dll - 9999 DOMAIN\user 65.53.75.132 MSFrontPage/6.0 200 0 0

Does any of this change for Visual Studio .NET 2005?

There are some changes to how Microsoft Visual Studio .NET 2005 will interact with Web projects. The main difference is that there is not a project file and there is not a dependency on IIS. Developers will be able to create Web applications on their hard disk. When the developers browse or debug the applications from the IDE, a small Web server is started on a unique port to serve the requests.

The following link contains a lot of information about Web projects in the upcoming Visual Studio .NET 2005 release:

↑ Back to the top


As always, feel free to submit ideas on topics you want addressed in future columns or in the Knowledge Base using the Ask For It form.

↑ Back to the top


Keywords: KB893665, kbasp, kbhowto

↑ Back to the top

Article Info
Article ID : 893665
Revision : 7
Created on : 11/16/2007
Published on : 11/16/2007
Exists online : False
Views : 363