Jump to content

Chnage project from Standalone server to ISAPI Module


Recommended Posts

Very easy...

You just  comment or  incoment  {$define UNIGUI_VCL} 

in your Source Project :

 

**************************************************************************

{$define UNIGUI_VCL}     // ISAPI --> Comment this line with //


{$ifndef UNIGUI_VCL}
library
{$else}
program
{$endif}
  Project1;

uses
windows,
ShellAPI,
SysUtils,
uniGUIISAPI,
Forms,
DataModule in 'DataModule.pas' {DM: TDataModule},
MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule},
Main in 'Main.pas' {MainForm: TUniForm};
{$R *.res}

{$ifndef UNIGUI_VCL}
exports
GetExtensionVersion,
HttpExtensionProc,
TerminateExtension;
{$endif}

begin
{$ifdef UNIGUI_VCL}
ReportMemoryLeaksOnShutdown := True;
Application.Initialize;
TUniServerModule.Create(Application);

// run directly in Browser
if extractFileExt(GetModuleName(Hinstance))='.exe' then
shellExecute(Application.Handle,
PChar('Open'),
PChar('Http://127.0.0.1:8077'),
Nil,Nil,SW_Show);


Application.Run;
{$endif}
end.

**************************************************************************

 

 

Best regards... 

Link to post
Share on other sites

it's very simple:

 

1. Comment out the first line : // {$define UNIGUI_VCL}

2. Close your project, then re-open it

3. Compile and build it again.

4. You will obtain your : Project1.dll

5. Create a Folder in D:\ and name it for example D:\MyWebDoc

6. Copy your project1.dll there.

 

7. Now, you have to create your server application :

Don't worry, just follow the Unigui.pdf guide (C:\Program Files\FmSoft\Framework\Unigui\Docs)

 

At this point, in a brief description : you will create an alias (let say MyAlias) to your folder (D:\MyWebDoc) wich contains your project1.dll.

 

You can see "Chee Yang Chau" setting for win 7, 8 and 10:

http://chee-yang.blogspot.com/2009/10/configure-windows-7-iis7-for-isapi-dll.html

 

8. Now, all ils ready. Just call your project from your browser like this:

192.168.0.1/MyAlias/project1.dll

 

(192.168.0.1 is your IP local server)

 

• You can run it from any local machine (intranet)

• You can suscribe for a VPS (Virtual Private Server) and run it from any device on the world (desktop, tablet, smartphone...) with any system (Microsoft, Android, Mac Os, and soon linux !?).

Best regards.

Link to post
Share on other sites

Many reasons for that. Please check :

 

1. First download the latest Trial UNIGUI 12.58

   You have not to download runtime ext js package from Sencha. It's an OEM embeded ext JS version 4.2.4.1720)

2. Important :  If your server (your machine) is windows 64 bits, and your Project1.dll  is 32 bits (on Delphi Target PlatForms),  then Enable your Pool Application to accept 32 bit = TRUE.

post-1785-0-88330100-1452851944_thumb.png

 

3. Not important but will enhance the dll launching : Your Project1.dll  will be smaller with a Buid Configuration = Release 

4. Restart your iis Server :

post-1785-0-30146200-1452852053_thumb.png

 

5. Check your RDBM  version 64 or 32 :  That must be the same in your development and on your server.

 

Good Luck  :blink: 

Link to post
Share on other sites

it's very simple:

1. Comment out the first line : // {$define UNIGUI_VCL}

2. Close your project, then re-open it

3. Compile and build it again.

4. You will obtain your : Project1.dll

5. Create a Folder in D:\ and name it for example D:\MyWebDoc

6. Copy your project1.dll there.

7. Now, you have to create your server application

You can add {$EXTENSION } compiler directive after programm/library lines.

{$EXTENSION dll}

{$EXTENSION exe}

 

This way you can skip reopening project.

  • Upvote 1
Link to post
Share on other sites
  • 4 weeks later...

You can add {$EXTENSION } compiler directive after programm/library lines.

{$EXTENSION dll}

{$EXTENSION exe}

 

This way you can skip reopening project.

in XE7 --> Project ---> view source , there is no lines with program or library , so how to convert project to isapi , the above method is not working :(

Link to post
Share on other sites
  • 3 months later...

In Delphi 2010 that I was using for several years , I had no problem changing the target through the directive UNIGUI_VCL.

The name in project manager was changing accordingly (Project.exe / Project.dll) , I had not even the need of closing and re-opening the whole project.

 

Now, I evaluate the Seattle and the method of changing (commenting out) the compiler directive in project source doesn't seem to work for the project name showing in IDE - Project manager, even with closing and re-opening project and/or Delphi itself.

 

For example , you see in the IDE that the target is the Project.dll , but the directive UNIGUI_VCL is active and the linker will link the project into the Project.exe. This will drive into misunderstandings.

 

 

The workaround I use is the following .

 

I create new configurations xxx_exe and xxx_dll

post-281-0-79423900-1463255516_thumb.png

 

I remove the {$define UNIGUI_VCL} from project source.

 

In xxx_exe configurations, I add the UNIGUI_VCL in conditional defines and exe as Target file extension

In xxx_dll configurations, I just change the Target file extension to dll

 

post-281-0-49143200-1463256436_thumb.png

post-281-0-38978600-1463256445_thumb.png

 

 

Please correct me if there is any easier way to jump from library to program linking.

 

 

Link to post
Share on other sites

it's very simple:

 

1. Comment out the first line : // {$define UNIGUI_VCL}

2. Close your project, then re-open it

3. Compile and build it again.

4. You will obtain your : Project1.dll

5. Create a Folder in D:\ and name it for example D:\MyWebDoc

6. Copy your project1.dll there.

 

7. Now, you have to create your server application :

Don't worry, just follow the Unigui.pdf guide (C:\Program Files\FmSoft\Framework\Unigui\Docs)

 

At this point, in a brief description : you will create an alias (let say MyAlias) to your folder (D:\MyWebDoc) wich contains your project1.dll.

 

You can see "Chee Yang Chau" setting for win 7, 8 and 10:

http://chee-yang.blogspot.com/2009/10/configure-windows-7-iis7-for-isapi-dll.html

 

8. Now, all ils ready. Just call your project from your browser like this:

192.168.0.1/MyAlias/project1.dll

 

(192.168.0.1 is your IP local server)

 

• You can run it from any local machine (intranet)

• You can suscribe for a VPS (Virtual Private Server) and run it from any device on the world (desktop, tablet, smartphone...) with any system (Microsoft, Android, Mac Os, and soon linux !?).

Best regards.

Hi

 

tanks for a good step by step working 

I did all of this steps and get this msg

 

An Exception has occured in application:

Cannot create file "C:\inetpub\eds7\cache\EDS7_dll\res\app_main_icon.ico". The system cannot find the path specified

Restart application

 

I stop the www server and start it again and made all of the folders again but I have error yet 

may help me ?

Link to post
Share on other sites

Hello Alberto,

To see the difference, you can compare the Source Project of a standalone project and an isapi project.

 

--------

Just add in your standalone source project :

 

1.

library

Project1;

 

2. uniGUIISAPI in your uses

 

3.

exports

GetExtensionVersion,

HttpExtensionProc,

TerminateExtension;

 

Best regards.

  • Upvote 1
Link to post
Share on other sites

Hello Alberto,

To see the difference, you can compare the Source Project of a standalone project and an isapi project.

 

--------

Just add in your standalone source project :

 

1.

library

Project1;

 

2. uniGUIISAPI in your uses

 

3.

exports

GetExtensionVersion,

HttpExtensionProc,

TerminateExtension;

 

Best regards.

Thank  you.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...