Board index » delphi » NT IIS 2.0 Isapi dll

NT IIS 2.0 Isapi dll

Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
works fine.  BUT when I make changes to the project, recompile, and try to
replace the previous version of the DLL I get an error saying the file is in
use.  Apparantly, the DLL is still loaded on the server.  

Do I have to program the DLL to unload itself after each use???  How can I
update the DLL without shutting down the server?

Thanks a million!!

Shayne Brandon

 

Re:NT IIS 2.0 Isapi dll


Sorry, but you have to shut down the server.  That is the one main
drawback to ISAPI programming.
-Ben Ziegler

Quote
Shayne Brandon (w...@ra.msstate.edu) wrote:

: Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
: in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
: works fine.  BUT when I make changes to the project, recompile, and try to
: replace the previous version of the DLL I get an error saying the file is in
: use.  Apparantly, the DLL is still loaded on the server.  

: Do I have to program the DLL to unload itself after each use???  How can I
: update the DLL without shutting down the server?

: Thanks a million!!

: Shayne Brandon

Re:NT IIS 2.0 Isapi dll


Note the section below I copied from Charlie Calvert's web page.....
for more info, check http://members.aol.com/charliecal/internet.htm
Aranya

===============================================================
Begin of copied section from Charlie Calvert's web page (this page might be copyrighted)

Note that if you copy the ISAPI1.DLL into the MYSTUFF directory multiple times you will need to
shut down the WWW portion of the Internet Server before each copy. The rule is that you can copy
the DLL the{*word*128}time for free, but after you have used it, it belongs to the server, and you
need to shut the WWW services on the server down before you can copy an updated version of the
file over the first copy. You can use the Internet Service Manager application to shut down the
WWW services. This application should be in the Microsoft Internet Server group created in the
Explorer/Program Manager at the time of the install of the Internet Information Server.

End of copied section from Charlie Calvert's web page
===============================================================

Quote
Shayne Brandon wrote:

> Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
> in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
> works fine.  BUT when I make changes to the project, recompile, and try to
> replace the previous version of the DLL I get an error saying the file is in
> use.  Apparantly, the DLL is still loaded on the server.

> Do I have to program the DLL to unload itself after each use???  How can I
> update the DLL without shutting down the server?

> Thanks a million!!

> Shayne Brandon

Re:NT IIS 2.0 Isapi dll


Note the section below I copied from Charlie Calvert's web page.....
for more info, check http://members.aol.com/charliecal/internet.htm
Aranya

===============================================================
Begin of copied section from Charlie Calvert's web page (this page might be copyrighted)

Note that if you copy the ISAPI1.DLL into the MYSTUFF directory multiple times you will need to
shut down the WWW portion of the Internet Server before each copy. The rule is that you can copy
the DLL the{*word*128}time for free, but after you have used it, it belongs to the server, and you
need to shut the WWW services on the server down before you can copy an updated version of the
file over the first copy. You can use the Internet Service Manager application to shut down the
WWW services. This application should be in the Microsoft Internet Server group created in the
Explorer/Program Manager at the time of the install of the Internet Information Server.

End of copied section from Charlie Calvert's web page
===============================================================

Quote
Shayne Brandon wrote:

> Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
> in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
> works fine.  BUT when I make changes to the project, recompile, and try to
> replace the previous version of the DLL I get an error saying the file is in
> use.  Apparantly, the DLL is still loaded on the server.

> Do I have to program the DLL to unload itself after each use???  How can I
> update the DLL without shutting down the server?

> Thanks a million!!

> Shayne Brandon

Re:NT IIS 2.0 Isapi dll


Quote
w...@ra.msstate.edu (Shayne Brandon) wrote:
>Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
>in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
>works fine.  BUT when I make changes to the project, recompile, and try to
>replace the previous version of the DLL I get an error saying the file is in
>use.  Apparantly, the DLL is still loaded on the server.  

>Do I have to program the DLL to unload itself after each use???  How can I
>update the DLL without shutting down the server?

Actually, I ran across a reference to a registry entry that supposedly would
turn off the DLL 'caching' by the IIS.  But, of course, I cannot remember where
I saw it, now.....I will look through the latest MSDN and TechNet stuff, maybe
it was there
Quote
>Thanks a million!!

>Shayne Brandon

Re:NT IIS 2.0 Isapi dll


Quote
bzieg...@Radix.Net (Ben Ziegler) wrote:
>Sorry, but you have to shut down the server.  That is the one main
>drawback to ISAPI programming.
>-Ben Ziegler

Actually someone responded to this with a registry key that told the IIS web
server to NOT cache DLLs, thereby allowing the changing on-the-fly.  Of course,
I have totally lost the reference, and cannot verify it.....
We just upgraded to the Universal subscription for the MSDN, I will start a
search in the morning and see if I can find any references.....
Quote

>Shayne Brandon (w...@ra.msstate.edu) wrote:
>: Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
>: in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
>: works fine.  BUT when I make changes to the project, recompile, and try to
>: replace the previous version of the DLL I get an error saying the file is in
>: use.  Apparantly, the DLL is still loaded on the server.  

>: Do I have to program the DLL to unload itself after each use???  How can I
>: update the DLL without shutting down the server?

>: Thanks a million!!

>: Shayne Brandon

Re:NT IIS 2.0 Isapi dll


Sorry, I was using my experience with Personal Web Server to answer
an IIS question, not very accurate!

Seems like a switch to turn of DLL caching would cause a pretty big
performance hit, unless you could specicifcally tell it which DLL's
to cache and which to load/unload on EACH web hit for that DLL.
-Ben

Quote
Thomas Hill (hi...@ionet.net) wrote:

: bzieg...@Radix.Net (Ben Ziegler) wrote:

: >Sorry, but you have to shut down the server.  That is the one main
: >drawback to ISAPI programming.
: >-Ben Ziegler

: Actually someone responded to this with a registry key that told the IIS web
: server to NOT cache DLLs, thereby allowing the changing on-the-fly.  Of course,
: I have totally lost the reference, and cannot verify it.....
: We just upgraded to the Universal subscription for the MSDN, I will start a
: search in the morning and see if I can find any references.....

: >
: >Shayne Brandon (w...@ra.msstate.edu) wrote:
: >: Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
: >: in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
: >: works fine.  BUT when I make changes to the project, recompile, and try to
: >: replace the previous version of the DLL I get an error saying the file is in
: >: use.  Apparantly, the DLL is still loaded on the server.  
: >
: >: Do I have to program the DLL to unload itself after each use???  How can I
: >: update the DLL without shutting down the server?
: >
: >: Thanks a million!!
: >
: >: Shayne Brandon

Re:NT IIS 2.0 Isapi dll


Quote
>Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
>in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
>works fine.  BUT when I make changes to the project, recompile, and try to
>replace the previous version of the DLL I get an error saying the file is in
>use.  Apparantly, the DLL is still loaded on the server.  

>Do I have to program the DLL to unload itself after each use???  How can I
>update the DLL without shutting down the server?

The file is in use becasue the DLL is still running. Once your DLL
finishes HttpExtensionProc the webserver simply puts the thread to
sleep and waits to call HttpExtensionProc again.

The easiest way to unload the DLL is to turn of the Web Publishing
Service. (you don;'t need to shut down to server - just stop and start
the service)

 or.
Turn off Extension Cacheing. This will adversely affect extension
performance (including ASP) but is a much better idea for development
purposes.

There is a registry entry under
CurrentControlSet/Services/W3Srvc/Parameters
called CacheExtensions - set it to 0.

or,
Develop your DLLs using Personal Web Server. Turning it off and on is
much easier, and it doesn't really matter if you turn off extension
cacheing when no else is using the webserver. It makes life alot
simpler.

woric faithfull

PS: if you need to debug your ISAPI extension then try my Trace
utility. It allows true real time monitoring of variables inside your
DLL whilst the webserver is running them.

The URL is http://www.magna.com.au/~woricf/trace/trace.htm

Re:NT IIS 2.0 Isapi dll


Quote
>Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
>in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
>works fine.  BUT when I make changes to the project, recompile, and try to
>replace the previous version of the DLL I get an error saying the file is in
>use.  Apparantly, the DLL is still loaded on the server.  

>Do I have to program the DLL to unload itself after each use???  How can I
>update the DLL without shutting down the server?

The file is in use becasue the DLL is still running. Once your DLL
finishes HttpExtensionProc the webserver simply puts the thread to
sleep and waits to call HttpExtensionProc again.

The easiest way to unload the DLL is to turn of the Web Publishing
Service. (you don;'t need to shut down to server - just stop and start
the service)

 or.
Turn off Extension Cacheing. This will adversely affect extension
performance (including ASP) but is a much better idea for development
purposes.

There is a registry entry under
CurrentControlSet/Services/W3Srvc/Parameters
called CacheExtensions - set it to 0.

or,
Develop your DLLs using Personal Web Server. Turning it off and on is
much easier, and it doesn't really matter if you turn off extension
cacheing when no else is using the webserver. It makes life alot
simpler.

woric faithfull

PS: if you need to debug your ISAPI extension then try my Trace
utility. It allows true real time monitoring of variables inside your
DLL whilst the webserver is running them.

The URL is http://www.magna.com.au/~woricf/trace/trace.htm

Re:NT IIS 2.0 Isapi dll


Quote
bzieg...@Radix.Net (Ben Ziegler) wrote:
>Sorry, I was using my experience with Personal Web Server to answer
>an IIS question, not very accurate!

>Seems like a switch to turn of DLL caching would cause a pretty big
>performance hit, unless you could specicifcally tell it which DLL's
>to cache and which to load/unload on EACH web hit for that DLL.
>-Ben

Found the registry entry:
  HKEY_LOCAL_MACHINE\System\CurrentCOntrolSet\Services\W3SVC\parameters\

name is 'CacheExtensions', value is '1' (YEs) or '0' (No)

Quote

>Thomas Hill (hi...@ionet.net) wrote:
>: bzieg...@Radix.Net (Ben Ziegler) wrote:

>: >Sorry, but you have to shut down the server.  That is the one main
>: >drawback to ISAPI programming.
>: >-Ben Ziegler

>: Actually someone responded to this with a registry key that told the IIS web
>: server to NOT cache DLLs, thereby allowing the changing on-the-fly.  Of course,
>: I have totally lost the reference, and cannot verify it.....
>: We just upgraded to the Universal subscription for the MSDN, I will start a
>: search in the morning and see if I can find any references.....

>: >
>: >Shayne Brandon (w...@ra.msstate.edu) wrote:
>: >: Me again!  I have created a simple ISAPI dll with Delphi 2.0.  When I put it
>: >: in the scripts dir on the NT 4.0 server and run it from a page or whatever, it
>: >: works fine.  BUT when I make changes to the project, recompile, and try to
>: >: replace the previous version of the DLL I get an error saying the file is in
>: >: use.  Apparantly, the DLL is still loaded on the server.  
>: >
>: >: Do I have to program the DLL to unload itself after each use???  How can I
>: >: update the DLL without shutting down the server?
>: >
>: >: Thanks a million!!
>: >
>: >: Shayne Brandon

Re:NT IIS 2.0 Isapi dll


I found  a way you don't need to shut down the server. Go to the Internet
Service Manager and Stop and then Start the service HTTP.

That's it!!
Humberto Aicardi

Ben Ziegler <bzieg...@Radix.Net> wrote in article
<5f473r$...@news1.radix.net>...

Quote
> Sorry, I was using my experience with Personal Web Server to answer
> an IIS question, not very accurate!

> Seems like a switch to turn of DLL caching would cause a pretty big
> performance hit, unless you could specicifcally tell it which DLL's
> to cache and which to load/unload on EACH web hit for that DLL.
> -Ben

Re:NT IIS 2.0 Isapi dll


Maybe you have some insight on another ISAPI / Delphi problem.  I have
written an ISAPI DLL  that works great. Now I need it to configure itself
from the server's registry. I have created some keys under the
HKEY_LOCAL_MACHINE but no matter what I do in the dll it doesn't read them.
It also doesn't report any errors. Just acts as if the keys were blank or
didn't exist.  I have also put code in to WRITE to the registry (to see if
it was looking elsewhere) and it does the same thing. pretends to write,
but doesn't actually write anything. no errors. no nothing.  (The same code
to read and write works fine from a regular GUI delphi app).

Any ideas??

Re:NT IIS 2.0 Isapi dll


Debugging Delphi ISAPI DLLs is a real pain in the kiester.
To maintain any sanity whatsoever, you need some type of TRACE'ing
tool.  I wrote my own, I'm sure there are several out there.
At a minimum you could send TRACE statements to a file and read
the file.

Make sure you record and TRACE out every return code from your
calls to reading and writing to the registry.

Another trick is to write a new Delphi DLL (and an EXE to call
it) to see if it really is some problem with being in a DLL
(I doubt it though).  The first thing you want to check is that
your code is getting called and what the return codes are.

-Ben Ziegler
Need to create Interactive Web Applications using Delphi?  Check:
http://www.radix.net/bziegler/wabd/wabd.htm

Philip A. Herzfeld (ph...@mysticsoftware.com) wrote:
: Maybe you have some insight on another ISAPI / Delphi problem.  I have
: written an ISAPI DLL  that works great. Now I need it to configure itself
: from the server's registry. I have created some keys under the
: HKEY_LOCAL_MACHINE but no matter what I do in the dll it doesn't read them.
: It also doesn't report any errors. Just acts as if the keys were blank or
: didn't exist.  I have also put code in to WRITE to the registry (to see if
: it was looking elsewhere) and it does the same thing. pretends to write,
: but doesn't actually write anything. no errors. no nothing.  (The same code
: to read and write works fine from a regular GUI delphi app).

: Any ideas??

Re:NT IIS 2.0 Isapi dll


Quote
bzieg...@Radix.Net (Ben Ziegler) wrote:
>Debugging Delphi ISAPI DLLs is a real pain in the kiester.
>To maintain any sanity whatsoever, you need some type of TRACE'ing
>tool.  I wrote my own, I'm sure there are several out there.
>At a minimum you could send TRACE statements to a file and read
>the file.

Yah, this is what I do....in the 'initialization ' section of the DLL I open a
global scope text file variable, write to it using writeln as needed, then close
it in the 'finalization' section.  Another way is to (gulp!) write HTML debug
statements that are sent to the browser in your error trap routines.
Quote

>Make sure you record and TRACE out every return code from your
>calls to reading and writing to the registry.

>Another trick is to write a new Delphi DLL (and an EXE to call
>it) to see if it really is some problem with being in a DLL
>(I doubt it though).  The first thing you want to check is that
>your code is getting called and what the return codes are.

>-Ben Ziegler
>Need to create Interactive Web Applications using Delphi?  Check:
>http://www.radix.net/bziegler/wabd/wabd.htm

>Philip A. Herzfeld (ph...@mysticsoftware.com) wrote:
>: Maybe you have some insight on another ISAPI / Delphi problem.  I have
>: written an ISAPI DLL  that works great. Now I need it to configure itself
>: from the server's registry. I have created some keys under the
>: HKEY_LOCAL_MACHINE but no matter what I do in the dll it doesn't read them.
>: It also doesn't report any errors. Just acts as if the keys were blank or
>: didn't exist.  I have also put code in to WRITE to the registry (to see if
>: it was looking elsewhere) and it does the same thing. pretends to write,
>: but doesn't actually write anything. no errors. no nothing.  (The same code
>: to read and write works fine from a regular GUI delphi app).

>: Any ideas??

Re:NT IIS 2.0 Isapi dll


Apparently there is a bug in the TRegistry implementation that manifests
itself on NT - something to do with security. I'm not quite sure where I've
learned that, but it might be worth checking on Dejanews. Or just try using
API directly.

HTH
Peter Szymiczek

Philip A. Herzfeld <ph...@mysticsoftware.com> wrote in article
<01bc3130$088ed1a0$2044aace@merlin>...

Quote
> Maybe you have some insight on another ISAPI / Delphi problem.  I have
> written an ISAPI DLL  that works great. Now I need it to configure itself
> from the server's registry. I have created some keys under the
> HKEY_LOCAL_MACHINE but no matter what I do in the dll it doesn't read
them.
> It also doesn't report any errors. Just acts as if the keys were blank or
> didn't exist.  I have also put code in to WRITE to the registry (to see
if
> it was looking elsewhere) and it does the same thing. pretends to write,
> but doesn't actually write anything. no errors. no nothing.  (The same
code
> to read and write works fine from a regular GUI delphi app).

> Any ideas??

Go to page: [1] [2]

Other Threads