Configuring IIS Web Sites and Virtual Directories

ImportantThe following article uses options that are available starting with the Professional edition and project type.

The IIS configuration tool helps you rapidly deploy web applications on Microsoft Windows servers family running Internet Information Services (versions 5.0 and above).

This Advanced Installer utility ensures a fast and uniform installation of your web applications on multiple servers, without having to worry about manually configuring the IIS on every machine through Microsoft Management Console.

This tutorial will guide you in creating Websites and Virtual Directories on IIS for your web application.

Let's suppose your web application consists of a E-Commerce web site, called example.com. This ASP.NET web application has a main user interface for registered users and guests as well as an Administration Panel. This panel will be served from a different secure location installed on the target server, hence the need to configure a separate virtual directory for this application.

1. Add your application files

FilesGo to the Files and Folders view and add your application files. The application's files for the Administration Panel, which will be handled by the virtual directory adminpanel of the web site, should be placed in a separate directory.

TipIt is redundant to add as a virtual directory a child folder of your application's web site folder, because this would already be served by your web site.

2. Add your Web Site

IISGo to the IIS Server view.

New Web SiteUse the [ New Web Site ] toolbar button to add your web site called example.com.

Configure it as follows:

Web Site Main

3. Configure Web Site Bindings

Configure HTTP and HTTPS bindings, along with the SSL options for your Web Site.

Web Site Bindings

ImportantThe triplet setting (IP Address, Port No, Host Header Name) defines the Web Site and therefore must be unique.

4. Configure Access Flags for your Web Site

In our scenario, the ASP.NET web application requires execute permission for the scripts as well as script access and read access.

Web Site Access

5. Set up default documents for your application

Our Web Site will automatically serve a default document when no document name is specified in the request (url). In our case index.aspx will have priority whenever found in a directory.

Web Site Documents

6. Enable FTP access

Our application requires FTP access for constant updating of script content, so we will configure FTP access for the web application. We do not set the "Set NTFS security flags" option to allow only registered users on the target machine, having the proper access rights, to connect through FTP.

Web Site FTP

7. Configure Virtual Directory in IIS

Our web site is set up now, we need to configure the Administration Panel as a virtual directory.

TipAs a rule, a virtual directory inherits general configuration traits like: default document list, mime types and access flags; so, we will configure such properties for the virtual directory only when a different behavior is desired.

Add Virtual DirectoryUse the [ New Virtual Directory ] to add a new virtual directory called adminpanel.

Configure it as follows:

IIS Virtual Directory configuration

We do not allow anonymous web access to this folder for security reasons (this is an administration panel with privileged access).

As opposed to the parent web site, this virtual directory needs an extra access flag (write access), so we will set it accordingly. Also we have disabled FTP access to this Virtual Directory.

TipIf you want to inherit the default document list configured for the parent web site check the “Enable default document” option and leave the document list blank. Otherwise, the documents configured here will override the ones configured for the parent web site.

If you disable default document for a web site or virtual directory, you should enable directory browsing instead.

8. Configure global IIS settings (optional)

If needed, you can also configure global IIS settings that will affect all web sites and virtual directories, such as: MIME types, ISAPI filters.

TipWe recommend that you check the “Create Backup of IIS Metabase” option as a configuration restore point option.

9. Run the project

BuildOur web site configuration is complete, build and run the package.

10. Video tutorials