Udostępnij za pośrednictwem


Running Web Applications on Windows Server 2008 with IIS 7.0 and Visual Studio

You can use Visual Studio to create and work with ASP.NET Web sites (which are also known as Web applications) in a variety of configurations. This includes Internet Information Services (IIS) sites, file-system sites, File Transfer Protocol (FTP)–deployed sites, and remote sites. For guidelines that can help you decide when to use each type of Web site, see Types of Web Sites in Visual Web Developer.

After you install IIS, you can configure Visual Studio to run and debug local ASP.NET Web sites by using IIS instead of by using the built-in ASP.NET Development Server. When you create a local IIS Web site, the pages and folders for the site are stored in a folder under the default IIS folder for Web sites. This is located at LocalDrive:\Inetpub\wwwroot. Visual Studio creates the appropriate IIS configuration so that the Web site is recognized by IIS as an application. 

You can also create a virtual directory. In that case, the files for the Web site can be in any folder on the Web server computer.

To create and work with ASP.NET Web sites without installing IIS, you can create a file-system Web site. For more information about file-system Web sites, see Types of Web Sites in Visual Web Developer.

Installing IIS and ASP.NET on Windows Server 2008

Installing the ASP.NET component of IIS 7.0 in Windows Server 2008 enables ASP.NET Web applications to run as local IIS Web sites. To enable Visual Studio to create and use local IIS Web sites, you must enable metabase compatibility. This lets Visual Studio interact with the IIS metabase and with the IIS 7.0 configuration store.

You must have administrative permissions to perform the following procedures. If Server Manager is not already displayed, follow this procedure to open it.

To open Server Manager in Windows Server 2008

  1. In Windows Server 2008, open Control Panel, click System and Maintenance, and then click Administrative Tools.

    Note

    If Control Panel is set to display in Classic View, you can click Administrative Tools directly.

  2. In the right pane, double-click Server Manager.

    The Windows Features dialog box is displayed.

    Note

    In Windows Server 2008, if User Account Control (UAC) is enabled, it might display a message when you try to access the Windows Features dialog box. Click Continue to access the dialog box. For more information, see User Account Control.

You can now install IIS 7.0. In Windows Server 2008, IIS is configured differently than in . In Windows Server 2008, Web server features are added by adding the Web server role to the server.

To install IIS and ASP.NET on Windows Server 2008

  1. In the left pane of Server Manager, select the node that represents the server that you are currently working on.

  2. In the right pane, expand the Roles Summary section and then click Add Roles.

    The Add Roles Wizard appears.

  3. Click Next.

    The wizard moves to the Select Server Roles step.

  4. Select the Web Server (IIS) check box and then click Next.

    The next wizard step that appears is information that guides you in the installation.

  5. Click Next.

    The wizard moves to the Role Services step. A list of available role services is displayed. If you click the name of a role, a short description of the role is displayed

  6. Select the Application Development role service, and then select the ASP.NET check box.

    Note

    You will be prompted with the related options that are also required for Web application development. Click Add Required Role Services.

  7. Select the IIS 6 Management Compatibility role service.

    Selecting the IIS 6.0 compatibility role enables Microsoft Visual Studio 2005 to manage IIS 7.0 configuration.

  8. Click Next and verify the role service selections.

  9. Click Install to start the IIS and ASP.NET installation process.

  10. When the installation is complete, click Close.

To enable Visual Studio to debug applications, you must configure IIS 7.0 with the Windows Authentication module. By default, the module is not configured as part of IIS. The following procedure assumes the Web server role has already been installed and that you are adding a new role service.

To configure Windows Authentication for IIS 7.0

  1. In Server Manager, under the Roles node, select the Web Server (IIS) role.

  2. In the Role Services section, click Add Role Services.

    The Add Role Services wizard appears.

  3. Under the Security role service, select the Windows Authentication check box.

  4. Click Next and verify the role service changes to be applied.

  5. Click Install to start the IIS and ASP.NET installation process.

  6. Click Close to close the Add Role Services wizard.

Starting the IIS 7.0 Web Server in Windows Server 2008

Web server services are included with Windows Server 2008. However, by default, when you first install Windows Server 2008, the Web server services are not installed. Adding the Web server role creates a Web server to which clients can connect by using the HTTP or HTTPS protocols. You can then use the Web server together with Visual Studio to develop and modify ASP.NET Web sites and applications.

To configure Windows Server 2008 to start an IIS 7.0 Web site

  1. In Server Manager, click the Web Server (IIS) node.

    If the node does not appear under the Roles node, refresh the view by selecting Refresh under the Action menu

  2. In the System Service section, make sure that the World Wide Web Publishing Service is running.

    If the service is not running, start it.

  3. Under the Web Server (IIS) node, select Internet Information Services (IIS) Manager, expand the name of the Web server, and then expand Sites.

  4. Right-click Default Web Site, and then click Start.

  5. If you need a secure Internet connection, set up Secure Sockets Layer (SSL). For more information, see How to: Set Up Secure Sockets Layer (SSL).

Running Visual Studio with Administrative Permissions in Windows Server 2008

To access local IIS Web sites, you must run Visual Studio in the context of an administrator account. By default, Windows runs applications in a limited-rights user account even when you are logged on to the computer as an administrator.

To run Visual Studio with administrative permissions in Windows Server 2008

  1. In Windows Server 2008, click Start, click All Programs, and then locate Visual Studio.

  2. Right-click Microsoft Visual Studio, and then click Run as administrator.

    Note

    If User Account Control (UAC) is enabled, it might display a message when you try to access the Windows Features dialog box. Click Continue to access the dialog box. For more information, see User Account Control.

See Also

Tasks

How to: Set Up Secure Sockets Layer (SSL)

Concepts

Running Web Applications on Windows Vista with IIS 7.0 and Visual Studio

Types of Web Sites in Visual Web Developer

Reference

ASP.NET IIS Registration Tool (Aspnet_regiis.exe)