Export (0) Print
Expand All

How to: Specify the Web Server for Web Projects in Visual Studio

When you run a file-system Web project in Visual Studio, you can specify the Web server that Visual Studio uses to run (test) the application. You can choose from the following Web servers:

Visual Studio Development Server

This is the default Web server in Visual Studio 2010 SP1 for file-based Web site projects or Web application projects.

IIS Express

This is another option for file-based Web-site or Web-application projects. It offers an experience closer to that of IIS 7 (Internet Information Services), but with greater flexibility in a development environment. For more information, see Using IIS Express.

IIS (Internet Information Services)

You can use IIS by having your project files folder point to an IIS virtual directory. For information about installing IIS, see Installing and Configuring IIS to Work with Visual Studio.

For more information about these servers, see Web Servers in Visual Studio for ASP.NET Web Projects.

NoteNote

You can use the Visual Studio Development Server or IIS Express only when you are testing projects in Visual Studio. Production Web applications should always run under IIS.

In a Visual Studio Web application project, you can specify the Web server in the Web tab of project properties. This choice offers the most configuration options. In Visual Studio 2010 SP1, you can also use the project context menu to easily switch Web site and Web application projects between the Visual Studio Development Server and IIS Express.

To specify the Web server for a Web application project by using project properties

  1. In Solution Explorer, right-click the name of the Web application project for which you want to specify a Web server, and then click Properties.

  2. In the Properties window, click the Web tab.

  3. To choose the Visual Studio Development Server, under Servers, click Use Visual Studio Development Server.

  4. To use a specific port number with the Visual Studio Development Server, select Specific port and enter the port number. By default, the Auto-assign Port option is selected, and the port number that has been assigned to your application appears.

  5. To choose IIS, under Servers, select Local IIS Web server. This option is not available if IIS is not enabled on your computer. A URL that combines localhost with the name of your Web application will automatically be created for you and appear in the Project URL box (for example, http://localhost/WebApplication1).

  6. To choose IIS Express, under Servers, select Local IIS Web server, and then select Use IIS Express. A URL with a random port number is automatically created for you and appears in the Project URL box (for example, http://localhost:2616/). The IIS Express option is unavailable if you do not have IIS Express installed on your computer, or if you are using a version of Visual Studio earlier than 2010 SP1.

  7. To choose a custom Web server, select Use Custom Web Server. In the Server URL box, type the URL that Visual Studio should start when it runs the current project.

    NoteNote

    If you selected Use Custom Web Server and specify the URL of a remote server (for example, an IIS Web application on another computer), be sure that the remote server is running the same version of the .NET Framework version as the current project.

To switch a Web server by using the project context menu

  • In Solution Explorer, right-click the project, and then click Use IIS Express or Use Visual Studio Development Server.

    NoteNote

    The option to use IIS Express will appear only if you are using Visual Studio 2010 SP1 and you have IIS Express installed.

To specify IIS Express as the default Web server for Web projects in Visual Studio

  1. On the Tools menu, click Options.

  2. In the Options dialog box, select Show all settings.

  3. Expand Projects and Solutions, and then click Web Projects.

  4. Select Use IIS Express for new file-based web sites and projects.

    NoteNote

    If you set IIS Express as the default Web server and then uninstall IIS Express, any site that was configured to use IIS Express will automatically run using the Visual Studio Development Server.

To specify the remote Web server for a Web site project

  1. In Solution Explorer, right-click the name of the Web site project for which you want to specify a Web server, and then click Property Pages.

  2. In the Property Pages dialog box, click the Start Options tab.

  3. Under Server, click Use custom server.

  4. In the Base URL box, type the URL that Visual Studio should start when it runs the current project.

    NoteNote

    If you specify the URL of a remote server (for example, an IIS Web application on another computer), be sure that the remote server application pool for the URL is using the same version of the .NET Framework as your Web site project. For FTP Web site projects, Visual Studio prompts you to specify a server URL the first time that you run the site. You can change the server URL at any time.

Community Additions

ADD
Show:
© 2014 Microsoft