Board index » delphi » How can I down a DLL without shut-down the IIS

How can I down a DLL without shut-down the IIS

Hi, people.

I built a Active Server Object in Delphi but it isn't complete. Then I nead
re-compile it many times yet. Is it possible to shut-dow only the DLL from
IIS without stop that service?

Thanks,
Ricardo Ildefonso.

 

Re:How can I down a DLL without shut-down the IIS


Quote
> I built a Active Server Object in Delphi but it isn't complete. Then I
nead
> re-compile it many times yet. Is it possible to shut-dow only the DLL from
> IIS without stop that service?

Ricardo,

I think only IIS can unload a dll that it loaded.  However, you can shut
down just a single IIS site.  (i.e. not the whole server) I wrote a utility
for this because there doesn't seem to be a standard command line for it.
Here's the source for the entire Delphi program.  If you'd prefer the
executable, let me know.
The way I used it was to put it in a batch file.  Each time I updated my
isapi dll, I ran a batch file that stopped the web site and then copied my
new dll.  The next call to the web site reloads the dll automatically.

Hope this does it for you!

-pete

program IsapiReload;

{$APPTYPE CONSOLE}

uses
  Activex,
  SysUtils,
  ComObj;

{ TODO -oUser -cConsole Main : Insert code here }

var
 WebSite, WebServer, WebRoot : Variant;
 ServerAddress, W3svcNumber, ApplicationPath : string;
 ObjectToGet, svcNumber, appPath : Variant;
begin
 if paramcount < 3 then
 begin
  writeln( output );
  writeln( output, 'Pd'' Programming Inc. 2002 www.pdmagic.com' );
  writeln( output, 'Released into the public domain Sept 15, 2002' );
  writeln( output, '----------------------------------------------' );
  writeln( output );
  writeln( output, 'syntax: IsapiReload <ServerAddress> <W3svcNumber>
<ApplicationPath>' );
  writeln( output, ' i.e.: IsapiReload localhost 2 Root/myApp' );
  writeln( output, 'note: function will fail if current user doesn''t have
access to modify server' );
  writeln( output, '  use "Operators" tab of IIS web site properties box to
specify users.' );
  exit;
 end;
 try
  CoInitialize( Nil );
  ServerAddress := ParamStr( 1 );   // 'houdini.pdmagic.com'
  W3svcNumber   := ParamStr( 2 );   // '18'
  ApplicationPath := ParamStr( 3 ); // 'Root/cmApp'

  WebSite := CreateOleObject('IISNamespace');

  ObjectToGet := ServerAddress + '/w3svc';
  WebSite := WebSite.GetObject('IIsWebService', ObjectToGet );

  svcNumber := W3svcNumber;
  WebServer := WebSite.GetObject('IIsWebServer', svcNumber);

  appPath := ApplicationPath;
  WebRoot := WebServer.GetObject('IIsWebVirtualDir', appPath);
  WebRoot.AppUnload;
  writeln( output, 'Server application unloaded' );
 except
  on e: exception do
   writeln( 'Exception: ' + e.message );
 end;
end.

Other Threads