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:
For more information about these servers, see Web Servers in Visual Studio for ASP.NET Web Projects.
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
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.
In the Properties window, click the Web tab.
To choose the Visual Studio Development Server, under Servers, click Use Visual Studio Development Server.
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.
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).
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.
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.
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.
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
On the Tools menu, click Options.
In the Options dialog box, select Show all settings.
Expand Projects and Solutions, and then click Web Projects.
Select Use IIS Express for new file-based web sites and projects.
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
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.
In the Property Pages dialog box, click the Start Options tab.
Under Server, click Use custom server.
In the Base URL box, type the URL that Visual Studio should start when it runs the current project.
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.