faqts : Computers : Programming : Languages : Delphi

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

24 of 30 people (80%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

Delphi: Internet: Intraweb: Application: Create: What are steps to create and run ISAPI dll in IIS?

Oct 8th, 2003 13:42
Knud van Eeden,


-----------------------------------------------------------------------
--- Knud van Eeden - Tuesday 15 July 2003 - 03:07 pm ------------------

Delphi: Internet: Intraweb: Application: Create: What are steps to 
create and run ISAPI dll in IIS?

---

Steps: Overview:

 1. -Create an ISAPI Dll for your Intraweb application in Windows
     (using Delphi with Intraweb)

 2. -Install this dll, by loading that dll in the web server
     (e.g. Microsoft Information Server (=ISS)).
     On Microsoft Windows XP by default the version 5.1
     is installed.

 3. -Run this web server (e.g. ISS) on the host machine

 4. -Contact this Intraweb application, by typing the IP address
     of the host machine and the correct port number
     in the (remote) browser URL.

---

Steps: Worked out:

 1. -start your Delphi

 2. -select from menu option
      'File->New->'Other'->'tab Intraweb'->'ISAPI application'

 3. -follow the next steps to create a simple Delphi Intraweb program
     as described at:

      http://www.faqts.com/knowledge_base/view.phtml/aid/23240/fid/175

 4. So your program should look like the following:
    (compile it to test it and rename this project to e.g.
     'reservation').

--- cut here ---------------------------------------------------------

unit IWUnit1;
{PUBDIST}

interface

uses
  SysUtils,
  IWAppForm, IWApplication, IWTypes, IWCompLabel, IWHTMLControls, 
Classes,
  Controls, IWControl, IWCompListbox;

type
  TformMain = class(TIWAppForm)
    AvailableList: TIWListbox;
    ReserveList: TIWListbox;
    AddLink: TIWLink;
    RemoveLink: TIWLink;
    IWLabel1: TIWLabel;
    IWLabel2: TIWLabel;
    CountLabel: TIWLabel;
    procedure AddLinkClick(Sender: TObject);
    procedure RemoveLinkClick(Sender: TObject);
    procedure PROCIntrawebLinkClickCentral( Sender: TObject );
  public
  end;

implementation
{$R *.dfm}

uses
  ServerController;

procedure TformMain.AddLinkClick(Sender: TObject);
begin
 PROCIntrawebLinkClickCentral( Sender );
end;

procedure TformMain.RemoveLinkClick(Sender: TObject);
begin
 PROCIntrawebLinkClickCentral( Sender );
end;

// --- LIBRARY --- //

procedure TformMain.PROCIntrawebLinkClickCentral( Sender: TObject );
var
 I: Integer;
 Dest: TIWListbox;
 Src: TIWListbox;
begin
 if Sender = AddLink then begin
  Dest := ReserveList;
  Src := AvailableList;
 end
 else begin
  Src := ReserveList;
  Dest := AvailableList;
 end;
 for i := Src.Items.Count - 1 downto 0 do begin
  if Src.Selected[i] then begin
   Dest.Items.Add(Src.Items[i]);
   Src.Items.Delete(i);
  end;
 end;
 CountLabel.Caption := IntToStr( AvailableList.Items.Count ) + ' 
available apartment(s).';
end;

end.

--- cut here ---------------------------------------------------------

    If you should compile this program, you will see the message
    'cannot debug project unless a host application is defined. Use 
Run|Parameters... dialog box'.

    ---

    To solve this, goto Delphi menu 'Run'->'Parameters',
    as 'host parameter' give the path to the executable of the Web 
server at which
    you will install your dll, as 'parameter' fill in nothing (or e.g. 
start)
    The 'start directory' is the same directory in which your .dll file
    is stored.

    See also: http://community.borland.com/article/0,1410,23024,00.html

    ---

    e.g. if Microsoft Information Server (=ISS) v5.1, this could be:

     'host application' = c:\windows\system32\inetsrv\inetinfo.exe

     'parameter' =

     'start directory' = the same directory where you have stored your 
current project (e.g. ..\reservation)

    ---

    After successful compilation in Delphi, that will create a .dll
    file (e.g. 'reservation.dll') in that directory, which you will now
    have to add to your web server (e.g. Microsoft Internet Information
    server (=ISS)), by copying it to a specific directory on your
    harddisk

    (for more Intraweb documentation: see also:
    http://www.atozedsoftware.com/intraweb/Download/index.iwp
     where you download 'IntraWeb Manual.pdf', and search for
     (use <CTRL><F>) for 'ISAPI')

 5. Install and or activate your Microsoft Internet Information server 
(=ISS)

     see also:

     http://www.faqts.com/knowledge_base/view.phtml/aid/12558


     or to install it, from the MSDOS command line type:

      c:\windows\system32\inetins.exe

     or also

      c:\winnt\system32\inetins.exe

     and follow the steps

  6. Now add to your the web directory of your Internet directory
     a (so called 'Virtual') subdirectory (which will need to have
     permission to run or thus execute your ISAPI dlls)

     In Windows XP Professional:

     1. -click the Windows 'Start' button

     2. -'Control Panel'

     3. -'Administrative tools'

     4. -'Internet Information Services'

     5. -click on the '+' in the left pane of your computer

     6. -click on the '+' of the web sites

     7. -right click on the 'Default Web site'

     8. -select from list 'New'

     9. -select from list 'Virtual Directory...'

    10. -this will start a wizard

        1. Click button 'Next'

        2. Choose an alias (e.g. 'myscripts', but you can
           choose whatever you want (except 'Scripts',
           as that is already existing))
           What you choose will have to be added inside
           the URL with which to call your ISAPI application

           e.g.

            http://<IP address>/<your alias>/...

           e.g.

            http://127.0.0.1/myscripts/...

        3. Choose the actual directory where this dll
           (e.g. 'reservation.dll') will have to be stored.
           If you have used the default installation path
           for Microsoft Internet Information server (=ISS)
           the default should be:

            c:\Inetpub\Scripts

        4. Choose the permissions
           (disable all options, except:

             X Execute

        5. Button 'Finish'

        6. You should now see 'you have successfully created a virtual 
directory'

        ---

        Note:

        make sure that you have permission to execute files
        in the c:\Inetpub\scripts directory.
        If not assign them as an administrator,
        and or contact your network administrator

    11. -copy your .dll file to this folder

          e.g. in an MSDOS box

           change to the directory in which you compiled your
           .dll, then type:

            copy <your filename>.dll c:\inetpub\scripts

            e.g.

            copy reservation.dll c:\inetpub\scripts

         (if you right click on the properties of your Microsoft
          Information Server (=ISS), directory 'myscripts', you will
          see this file in there, and this file 'reservation.dll' at
          the same time in the directory 'Scripts')

    12. -If you now test this installation of your .dll as a module
         of Microsoft Internet Information server (=ISS)

         (make sure this ISS program is activated and running,
          e.g. by typing http://127.0.0.1 in the webbrowser
          on the machine that is running the
          Microsoft Information Server (=ISS).
          You should then see the start page of this web server))

         by opening for example your web browser on that local
         machine, and typing:

          http://<yourwebserver IP address or name>\<your 
virtualdirectory alias>\<YourDLLName>

          or when your Microsoft Information Server (=ISS) is using 
another
          port, type:

          http://<yourwebserver IP address or name>:<IIS port>\<your 
virtualdirectory alias>\<YourDLLName>

         e.g.

          http://127.0.0.1\myscripts\reservation.dll

         Note:
         if you do not type the extension '.dll' here, it will not 
work.

---
---

This has been tested and was running OK using:

-Microsoft Windows XP Professional

-Delphi v7

-Intraweb v5.0.43

-Microsoft Information Server (=ISS) v5.1

---
---

Internet: see also:

Intraweb documentation:
http://www.atozedsoftware.com/intraweb/Download/index.iwp]

---

Delphi: Internet: Intraweb: Application: Create: What are steps to 
create Intraweb application?
http://www.faqts.com/knowledge_base/view.phtml/aid/23243/fid/175

---

Delphi: Internet: Intraweb: Application: Create: Simple: How create 
apartment reservation program?
http://www.faqts.com/knowledge_base/view.phtml/aid/23240/fid/175

---

IIS: How to install Microsoft Information Server (IIS) on 
Windows2000/XP Professional?
http://www.faqts.com/knowledge_base/view.phtml/aid/12558

-----------------------------------------------------------------------