Local IIS Web Sites
A local Internet Information Services (IIS) Web site is an IIS Web application on your computer. Creating or opening a local IIS Web site is useful in the following situations:
-
You want to test your Web site using IIS, which closely emulates how the Web site will run on a production server. This can have advantages over working with file system Web sites that run using the ASP Development Server, because paths are resolved as they will be on a production server.
-
You already have a set of Web site files in a folder and you want to test the Web site with IIS. In this case, you can create a virtual directory in your local version of IIS.
-
Your local computer is also your Web server.
Requirements
To create a local IIS Web site requires the following:
-
Your computer must have at least IIS version 4.0 installed and running.
-
ASP must be enabled in IIS version 6.0. To enable ASP by using IIS Manager, expand the local computer, and then click Web Service Extensions. In the details pane, click Active Server Pages, and then click Allow.
-
You must be logged in as a user with administrative privileges. This is required because working with the IIS metabase (where information about IIS applications is stored) requires administrative privileges.
To open an existing local IIS Web site, the preceding must be true as well as the following:
Note: You can create an IIS application as a subfolder of any existing IIS folder.
Running Local IIS Web Sites
When you run a local IIS Web site to test it, launches a browser and runs the Web site using the server name localhost. For example, if you have created the Web site ExampleSite, when you test it, go to the following URL:
http://localhost/ExampleSite/
IIS resolves the application name, whether it points to a folder that is under the IIS root or to another location, and serves pages from that folder.
Deploying Local IIS Web Sites
Local IIS Web sites are generally used only for development, so that individual developers can create and test ASP Web pages on their own computers. In most cases, you must deploy the files from a file system Web site to a production server that is running IIS.
Creating Virtual Directories in IIS
In most cases, the content you publish to your Web or FTP site is located in a root or home directory on your computer, such as C:\Inetpub\wwwroot\. However, there might be instances when the content is located somewhere else, or even on a remote computer.
To publish from any directory not contained within your home or root directory, you can create a virtual directory. A virtual directory is a directory that is not contained in the home directory but appears to client browsers as though it were.
You can create a virtual directory through IIS Manager or by using Windows Explorer.
Important: You must be a member of the Administrators group on the local computer to perform the following procedures.
To create a virtual directory by using IIS Manager
-
In IIS Manager, expand the local computer, expand the Web Sites folder, right-click the site or folder within which you want to create the virtual directory, point to New, and then click Virtual Directory. The Virtual Directory Creation Wizard appears.
-
Click Next.
-
In the Alias box, type a name for the virtual directory. (Choose a short name that is easy to type because the user types this name.)
-
Click Next.
-
In the Path box, type or browse to the physical directory in which the virtual directory resides, and then click Next.
Note: This path is the root of your ASP Web application.
-
Under Allow the following permissions, select the check boxes for the access permissions you want to assign to your users, you must select Read and Run scripts, and then click Next.
Note: The IIS Manager UI only configures settings at the IIS scope, so the "Read", "Write", "Script source access", and "Directory browsing" check boxes only affect IIS-level behavior. These access controls in IIS have nothing to do with allowing/denying writing to an Access database or uploads, so enabling "Read" while disabling "Write", "Script source access", and "Directory browsing" definitely do nothing as far as denying writing to an Access database or uploads is concerned. Also see Configuring Permissions below.
-
Click Finish. The virtual directory under the default website is created at the selected folder and is displayed in the IIS manager.
Note that the virtual directory setup as an ASP application is displayed with a icon. (The screenshot is from Windows 2003 server. The icon may be different in other versions of Windows.) Remember that this is the root of your ASP application. (If the virtual directory is not an ASP application, it is displayed with a icon, the application root for scripts under this directory will be an upper level virtual directory or website setup as ASP application.)
Right-click the Virtual Directory and then click Properties. If the virtual directory is an ASP application, the application root is displayed in the [Local path] textbox and the button next to [Application name] will be displayed as [Remove]. Otherwise, the button will be displayed as [Create] and you can click to make the virtual directory an application.
For real websites, e.g. if you use Web hosting, the application root is usually setup at the root of the website. For local IIS website during development, the application root is usually a virtual directory under the Default Web Site.
To create a virtual directory by using Windows Explorer
-
Open Windows Explorer.
-
Right-click the folder you want to be a virtual directory, and click Sharing and Security.
Note: This folder will be the root of your ASP Web application.
-
Click the Web Sharing tab.
-
Click Share this folder.
-
In the Alias box, type the name for the virtual directory.
-
Click OK twice.
Note: You can not change the ASP version by using Windows Explorer.
Creating Virtual Directories in IIS 7 (Windows Vista or Later)
The IIS manager user interface consists of three panes.
The left hand side pane is Connections, the middle pane is Workspace and the right hand side pane is Actions.
The Connections pane lists application pools and websites. The workspace pane consists of two tabs at the bottom namely Features View and Content View. The Features View allows you to work with the settings of the selected item from Connections pane whereas the Content View displays all the child nodes (content) of the selected item.
Application pool is a group of IIS applications that are isolated from other application pools. Each application pool runs in its own worker process. Any problem with that process affects the applications residing in it and not the rest of the applications. You can configure application pools individually.
In order to create a new application pool, select "Application Pools" under Connections pane. Then click on "Add application pool" from Actions pane. This will open a dialog as shown below:
Specify a name for the new pool to be created. Select .NET framework version that all the applications from the pool will use. Also select pipeline mode. There are two pipeline modes viz. integrated and classic. The integrated mode uses the integrated request processing model whereas the classic mode uses the older request processing model. Click OK to create the application pool.
Your new application pool will now be displayed in the Workspace pane. To configure the application pool click on the "Advanced Settings" option under Actions pane. The following figure shows many of the configurable properties of an application pool.
If you use 64-bit Windows, set Enable 32-Bit Applications to True. (See Running Classic ASP on 64-bit Windows Operating System below.)
To create a new web site, select Web Sites node under Connections pane and then click on "Add Web Site" under Actions pane. This opens a dialog as shown below:
Here, you can specify properties of the new web site including its application pool and physical location.
Creating an IIS application or a Virtual Directory is quick and simple. Just right click on the web site and choose either "Add Application" or "Add Virtual Directory" to open respective dialogs (see below).
An existing Virtual directory can be marked as an IIS application by right clicking on it and selecting "Convert to Application".
Once you create a website or an IIS application, you can then set several ASP related configuration properties via Workspace pane.
Go to ASP->Debugging Properties->Send Errors to Browser, set it to True,
You may encounter the following error messages when you run ASP pages with IIS 7:
1. Error message when you request an ASP page that connects to an Access database in IIS 7.0: "Microsoft JET Database Engine error '80004005'"
Read http://support.microsoft.com/kb/926939
2. Error message when you request an ASP page: "An error occurred on the server when processing the URL. Please contact the system administrator"
Go to Internet Options->Advanced, disable "Show friendly HTTP error messages".
Configuring Permissions
An important aspect of working with an Access .mdb file and file upload to a folder on the Web server is to correctly configure permissions.
When a Web application uses an Access database, the application must have Read permission to the .mdb file so the application can access the data. Additionally, the application must have Write permission to the folder that contains the .mdb file. Write permission is required because Access creates an additional file that has the extension .ldb in which it maintains information about database locks for concurrent users. The .ldb file is created at run time.
By default, the anonymous IIS user is IUSR_<MachineName>. Therefore, to use an Access database in an ASP Web application, you must configure the folder that contains the Access database to have both Read and Write permissions for the IUSR_<MachineName> user account.
If you specify database path, ASPMaker also creates the database folder but you may need to set the permissions yourself. To set permissions in the database folder,
-
In Windows Explorer, move to the root folder for the Web site. e.g. C:\Inetpub\wwwroot\ExampleSite.
-
If the database folder does not already exist, create one.
-
Right-click the database folder, click Properties, and then click the Security tab.
-
Under Group or user names, look for IUSR_<MachineName>.
-
Verify that the account has Read and Write permissions for the database folder.
Similarly, set permissions in the folder where the uploaded file and audit trail log file reside.
Running Classic ASP on 64-bit Windows Operating System
Windows Server 2008 64-bit (IIS 7)
On 64-bit Windows 2008, IIS 7 can run both 32-bit and 64-bit worker processes simultaneously. To run 32-bit Web applications in IIS 7 on 64-bit Windows 2008 all it needs is to assign the 32-bit applications to a separate application pool in IIS and turn on the Enable 32-Bit Applications switch for that application pool. To do this, open IIS Manager, open Application Pool, select the application pool, and then click Advanced Settings. In Enable 32-Bit Applications, select True.
Windows Server 2003 64-bit (IIS 6)
On 64-bit Windows 2003, although IIS 6 supports running both 64-bit and 32-bit worker processes, it doesn't support running in both modes simultaneously. By default IIS 6 is configured to run in native 64-bit mode and work only with 64-bit worker processes, which means you can only run 64-bit Web applications (for ASP.NET applications they can only target ASP.NET version 2.0 or higher) in the native mode. In order to run 32-bit Web applications you will need to set IIS 6 to run in 32-bit mode. Note: This means all your Web applications will now run in 32-bit mode.
To enable IIS 6 to run 32-bit worker processes follow these steps:
-
Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory
-
Type the following command:
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 "true"
-
Press ENTER
-
Afterwards restart IIS by using the iisreset command from the command-line
The following article explains the details of the changes in the behavior of IIS after configuring it to run 32-bit worker processes: Running 32-bit Applications on 64-bit Windows (IIS 6.0)
***********************************************************************
another procedure for win 7 and Vista
Deployment
******************************************************
Installing IIS 7.5 on Windows 7 Professional, Enterprise, or Ultimate
Applies To: Windows 7
By default, IIS 7.5 is not installed on Windows® 7 Professional, Enterprise, or Windows® 7 Ultimate. You can install IIS by clicking Windows Features in Advanced Options under Programs in Control Panel.
You can also use the Web Platform Installer (Web PI) to easily install IIS, and applications that run on IIS. The Web PI is a free, lightweight tool that lets you install IIS and related technologies such as ASP.NET, SQL Server Express, Visual Web Developer, other popular Web applications, and more. Because the Web PI installs the latest versions of available Web Platform offerings, with just a few simple clicks you can download and install any new tools or updates. To learn more about the Web PI, see click="javascript:Track('ctl00_MTCS_main_ctl00|ctl00_MTCS_main_ctl01',this);" target="blank">Learn more and install the Web PI.
Note |
You must be a member of the Administrators group to install IIS 7.5.
|
To Install IIS 7.5 on Windows 7
You can perform this procedure using the user interface (UI) or a script.
Using the UI
-
Click Start and then click Control Panel.
-
In Control Panel, click Programs and then click Turn Windows features on or off.
-
In the Windows Features dialog box, click Internet Information Services and then click OK.
Important |
If you use Control Panel to install IIS, you get the default installation, which has a minimum set of features. If you need additional IIS features, such as Application Development Features or Web Management Tools, make sure to select the check boxes associated with those features in the Windows Features dialog box.
|
Using a script
-
Type the following command into a script:
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;IIS-FTPPublishingService;IIS-FTPServer;IIS-FTPManagement;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI
Important |
If you use this script, you get the full IIS 7.5 installation, which installs all available feature packages. If there are feature packages you do not need, you should edit the script to install only the packages you require.
|
See Also