Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Dr.Bob's Delphi Notes Dr.Bob's Delphi Clinics Dr.Bob's Delphi Courseware Manuals
 Dr.Bob Examines... #123
See Also: Dr.Bob's Delphi Papers and Columns

Deployment on Windows Server 2008 and IIS7
When building web server (WebBroker, WebSnap or IntraWeb) or SOAP Web Service or even DataSnap web server applications, there is often a need to deploy these applications on a web server running Windows Server 2008. Most often, the application type is an ISAPI DLL (for IntraWeb or DataSnap for example), but it can also be a CGI executable. In this article, I will show how to deploy ISAPI DLLs or CGI executables on Windows Server 2008.
Windows Server 2008 comes with Internet Information Server (IIS) version 7, which looks and feel different (and works different) compared to IIS6 on Windows Server 2003. First of all, when working with Windows Server 2008, you have to make sure to install Internet Information Services, and the "CGI" and/or "ISAPI Extensions" Application Development Features.

Note that you may only need to select one of these if you decide to deploy only CGI or ISAPI extensions instead of both types!

In the above screenshot, both CGI and ISAPI Extensions have been selected.But in practice, you may already have decided to deploy only CGI executables, or only ISAPI DLLs, in which case you only have to configure the CGI or ISAPI Extension options of course.
Once IIS7 is installed correctly, and you can view http://localhost in a browser , it's time to configure IIS and add the virtual directory.

From the Administrative Tools in the Windows’ Start menu, select the Internet Information Services (IIS) Manager. Alternately, right-click on the My Computer icon and select Manage.Then, inside the Server Manager dialog, open the Roles node and select the Web Server (IIS) node.The subnode Internet Information Services (IIS) Manager will show you the IIS Manager as well.

In the windows that follows, select your machine (WS2008 in my case), and then in the middle of the screen select the "ISAPI and CGI Restrictions" icon (see screenshot on the next page).

Double-click on the "ISAPI and CGI Restrictions" icon. In the overview that follows, click on the "Edit Feature Settings..." action item on the right side.This gives a dialog, Edit ISAPI and CGI Restriction Settings, and check the Allow unspecified CGI modules and/od Allow unspecified ISAPI modules.

Once CGI and/or ISAPI Settings are possible, we can move down the tree on the left, and select the web site where we want to deploy the application.
Right-click (in this case on the Default Web Site) and select "Add Virtual Directory"

In the dialog that follows, specify the alias (Deployment in this case) as well as the physical path.

In our case, the physical path is c:\inetpub\wwwroot\Deployment. Make sure that the directory exists (otherwise you will get an error message).

When the virtual directory is created, make sure to select it in the left side of the IIS Manager window, and then in the middle pane select the Handler Mappings.

Click on the "Edit Permissions..." action item, which changes the screen to the Handler Mappings contents, which shows the CGI.exe and ISAPI.dll features disabled by default.

Click on the "Edit Feature Permissions..." action item, and in the Edit Feature Permissions dialog that follows check the Execute right item.

This completes the steps to enable CGI and/or ISAPI Extensions on IIS7. We can now deploy CGI and/or ISAPI extensions in the Deployment virtual directory on the default web site.

Note that apart from a virtual directory – which is enough for CGI or ISAPI Extensions – you can also create an application (using the “Add Application” context menu on the web site). This gives you a similar dialog, but with a few more options such as an Application pool that can be used to manage the CGI and ISAPI extensions in the application directory.

This is mainly helpful when working on ASP.NET projects by the way.

This webpage © 2010 by Bob Swart (aka Dr.Bob - Rights Reserved.