Developing and Deploying IntraWeb Applications on .NET
Many of you already know IntraWeb and how easy it is to develop a web application that runs either as standalone executable or ISAPI extension on Microsoft’s Internet Information Services (IIS). Since Delphi 8 IntraWeb also compiles under .NET. Development is still easy, but it’s not that widely used. This article will give an overview of how and why IntraWeb for .NET might be used.
Since Delphi 8 IntraWeb also compiles under .NET. Development: is still easy, but it’s not that widely used
Deployment Modes
A deployment mode (or “Application Type” as it is called on IntraWeb’s application wizard) determines how the Web application is run. IntraWeb basically has two deployment modes:
- Standalone (Desktop or Service)
- ISAPI
Standalone
The deployment type is chosen when you start a new IntraWeb project (see figure 1). For development and testing your application you should always use the “Standalone Desktop” type.

Fig. 1: Selecting the Application Type (Deployment Mode)
This standalone executable has everything compiled in and can just be run. It contains a full webserver, thus nothing else (like Cassini or Webapp debugger) is needed – except any database or other drivers your application uses. When you run such an IntraWeb Server you will see a debug window like the one in figure 2.

Fig. 2: IntraWeb’s Debug Window in Standalone Mode
This window makes it easy to start a web browser on the same machine, which directly starts the web application. Just click on the left-most icon on the toolbar (the sphere) or hit its [F9] shortcut, and a new instance of your default web browser will be started and show the start page of your application. Note that this “debug window” is never seen by your clients. It is only visible for you.
There are a couple of debugging features available. The two most interesting ones are probably these:
- The “Log tab”. There you can see your license information and (if you clicked the small glasses toolbar icon) log information when new sessions are created or other request are coming in.
- The “Speed Simulation” combobox. When you run the browser and server on the same machine then you will have “unlimited” line speed. This is of course not realistic. Select for example “Dial-Up 28.8 Kb” to see how a fast (actually slow) user how is connected via a 28.8 modem would access your application.
The desktop standalone type should never be used for production: it would need a user to be logged on and run that application on the server machine
Service Application
The desktop standalone type should never be used for production. It would need a user to be logged on and run that application on the server machine. Once your application is tested, then you should compile your application as “Service Application”. The main difference is that there is no more debug window and that the application can now be installed as service under Windows:
Project1.exe -install
Don’t forget to start the service using Window’s service manager.
Important to know is, that service applications may have different permissions (look at the account that runs your application in Window’s service manager) and that certain things won’t work. Mapped drive letter are not available for example. Use UNC paths instead, if you need to get access to files on different servers.
ISAPI Extenstions
ISAPI extensions are DLL’s which are run by ISAPI capable web servers, such as Microsoft’s IIS. To install an ISAPI DLL you have to create a virtual directory in IIS and map it to a folder such as
C:\inetpup\isapi
Now give it execution rights for ISAPI. In IIS 6.0 you have to add your DLL to the allowed ISAPI extenstions list, otherwise IIS will block access to that DLL. Now the application can be started via: http://www.yourserver.com/isapi/project1.dll.
To replace a running ISAPI DLL with a new version you have to “unload” your virtual directory (see figure 3). Sometime this won’t work and you have to restart the whole IIS.

Fig. 3: Unlad a virtual directory
Changing Application types
What if you started as standalone application and now want to deploy as ISAPI (or vice versa)? Changing deployment modes is easy. You just have to create an additional DPR file which shares all units of your project. You could even add both DPR’s (standalone and ISAPI) to a project group so that you can compile either one. Through the comments in listing 1 you can recognize the differemt parts:
program Project1; // stand alone
uses
Forms,
IWMain,
Unit1 in 'Unit1.pas' {IWForm1: TIWAppForm},
ServerController in 'ServerController.pas'
{IWServerController: TIWServerControllerBase},
UserSessionUnit in 'UserSessionUnit.pas'
{IWUserSession: TIWUserSessionBase};
{$R *.res}
Begin
Application.Initialize;
Application.CreateForm(TformIWMain, formIWMain);
Application.Run;
end.
library Project2; // ISAPI
uses
ISAPIApp,
IWInitISAPI,
Unit2 in 'Unit2.pas' {IWForm2: TIWAppForm},
ServerController in 'ServerController.pas'
{IWServerController: TIWServerControllerBase},
UserSessionUnit in 'UserSessionUnit.pas'
{IWUserSession: TIWUserSessionBase};
{$R *.RES}
Exports
GetExtensionVersion,
HttpExtensionProc,
TerminateExtension;
Begin
IWRun;
end.
Listing 1: Different Application Types
.NET Applications
Currently IntraWeb supports .NET with Delphi 2005 and BDS 2006. My recommendation is to use BDS 2006 though. The .NET part has been improved in BDS 2006 by CodeGear and works just better as in Delphi 2005.
For .NET IntraWeb also has two types:
- Standalone Application (Desktop only, no service)
- ASP.NET Assembly
For Standalone there is not much to explain, except that there is no service type application for .NET currently. Just compile and run the application as you know it from Win 32.
ASP.NET Assemblies
Hm, why ASP.NET? Aren’t we doing an IntraWeb application and not using its competitor ASP.NET? Well, an IntraWeb .NET assembly re-uses the infrastructure that .NET provides to run a “module” through a web server. This infrastructure is part of ASP.NET, but internally IW.NET applications are still “IntraWeb” .
.NET 1.1 or 2.0?
As Delphi is still .NET 1.1 any compiled IntraWeb.NET application is a .NET 1.1 one. If your server has .NET 2.0 installed only, then don’t worry. .NET 2.0 is backward compatible and IntraWeb will work with 2.0 as well.
Make sure your IIS has ASP.NET correctly installed. You can run the following command to re-register ASP.NET with IIS:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>
aspnet_regiis.exe –i
The advantages of using .NET are basically two (besides of the fact that there are tons of libraries to use):
- Virtual directories are basically optional
- No need to manually unload assemblies
If you don’t want to create a virtual directory, then you have to but the assembly into the root bin folder, for example into c:\inetpub\bin (assuming your web site uses c:\inetpub as root dir).
Now put a web.config (or modify if there is already one) like this into any folder below c:\inetpub:
type="Project1.IntrawebHandler, Project1"/>
xmlns="urn:schemas-microsoft-com:asm.v1">
If you put it for example into c:\inetpub\applications\ then your application will be accessible via: www.yourserver.com/applications/iwtest.aspx.
Note that there is no iwtest.aspx – we are just using ASP.NET handling mechanism to map the “verb” iwtest.aspx to a specific assembly – the one we compiled with Delphi/IntraWeb.
Conclusion
.NET has many interesting and flexible options and this article is just a brief overview of how to get started. If you want to know more, then don’t miss my session(s) on the next SDE!