how to use multiple dll in apache created with delphi on 2 different ports

162 Views Asked by At

I have created 2 apache dll using delphi and this guide:

https://docwiki.embarcadero.com/RADStudio/Sydney/en/DataSnap_REST_Application_Wizard_for_Windows

then I tried installing the first on apache like this:

LoadModule webbroker_module modules/mod_webbroker.dll
<Location /xyz>
  SetHandler mod_webbroker-handler
</Location>

and it works.

When I try to add the second module like this, just below:

LoadModule reportbuilder_module modules/mod_reportbuilder.dll 

<Location /rbbin>
  SetHandler mod_reportbuilder-handler
</Location>

Alias /rbcache/ "C:/Apache24/htdocs/rbbin/rbcache/"
<Directory "C:/Apache24/htdocs/rbbin/rbcache">
  Options All
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

I receive an error from apache saying

only one data module per application

What I would like to achieve is that if I go on port 85 it uses module 1 and if I go on port 86 it uses module 2.

How can I do that?

Thank you

2

There are 2 best solutions below

1
mjn On

It seems like both DataSnap DLLs call a routine which wants to create a TDataModule. The second call fails with the message 'only one data module per application'.

To verify, you could:

  • remote debug into the DLL startup code.
  • test with one DataSnap DLL and one which is not using DataSnap based.

However, I don't know if it is possible to use two or more DataSnap DLLs in the same Apache process.

1
mjn On

One possible workaround which is easy to test:

  • Run two Apache HTTP server instances (on different ports).

This will keep the DataSnap DLLs separated, one per process.

For access from the "outside world" (Internet), you may use a reverse proxy so all clients can connect using default HTTP(S) ports.