ISAPI DLL Maintainence requests

The Web Connection wc.dll provides a number of built in functions for managing Web Connection servers. These maintainence functions are available only through the Web interface of an application and follow a very specific format.

All of the maintainence requests are accessed by using a special syntax with the ISAPI DLL. For example to release all servers you would access:

http://localhost/wconnect/wc.dll?_Maintain~Release

You use _maintain to let the ISAPI DLL know that it's to expect a maintainence request. The second parameter then specify the operation to perform - in this case Release.

Security
Access to all maintainence functions of the DLL is controlled via Basic Authentication (on NT/2000 accounts) on the Web server. A special key in wc.ini AdminAccount determines which account has access to maintainence functions. This key can be blank to not check for Authentication, Any to allow any logged in account (ie. anything but the anonymous IUSR_ account) or a valid NT user account name. For more details see the wc.ini section under AdminAccount.

Maintenance DLL Status Page
To facilitate the process of the maintenance functions, a special link on the admin page called Show and Manage DLL settings allows access to most of the DLL maintenance functionality via an HTML interface. The page is accessed with wc.dll?_maintain~ShowStatus and looks like this:

This page shows the current status of most of Web Connection's settings that are loaded from the wc.ini file at startup. You can use the Re-read configuration link to reload the settings from the INI file. This link is extremely useful for debugging Web Connection problems as it shows you the real settings that the Web Connection ISAPI is running right now.

This page also allows you to switch between file based messaging and COM based messaging, put the server on temporary hold (Hold Requests) and lets you load and unload the currently running servers when running in COM mode. The COM server list shows the currently running servers and their status. Hits shows the cumulative number of hits against your Web Connection Server, Active requests shows the number of seconds the currently active request has been running if any (this will rarely show anything unless you have a long running request), and Cumulative shows the cumulative seconds that your server has spent processing requests since it was started.

The _maintain ISAPI DLL request parameters
The following table lists all of the maintainence features available inside of the ISAPI DLL. You access these by specifying wc.dll (or a script map thereof) and addressing it like this:

wc.dll?_maintain~MaintRequest

where MaintRequest is one of the parameters from the table below:

ISAPI Command

What it does

COM

File

ShowStatus

Displays information of the current settings of the DLL. For Automation servers this display also shows which servers are loaded and if they are currently busy. This link summarizes the most important settings in wc.ini and you should use it to make sure you have all expected settings correctly set.

u

u

ShowStatusXml

Displays the same information that ShowStatus displays but in XML format for remote checks of status.

u

u

Load

Loads all the specified Automation servers into memory from the DLL startup INI file.

u

 

Release

Releases all Automation servers from memory.

u

 

StartEXE

Starts an EXE specified in ExeFile in the DLL Ini file for file based messaging. The EXE is started in the System context so it will run invisibly when started from a Service. You can make the session visible by allowing the service to 'Interact with Desktop' in the Service manager. Use this only if you've crashed the server, or if you've switched from Automation to File based and you need to get one server started to manage additionals.

 

You can also use the FileStartInstances key in wc.ini to force instances to start up when the DLL first loads simulating behavior of an NT service and OLE Automation with file based operation.

 

u

UpdateExe

Updates the EXE file as specified by the INI file EXEFile and UpdateFile keys. With Automation the process is automatic: Servers are unload, the Hold RequestFlag is set and the EXE file is copied. The servers are then reloaded. With file based messaging you are responsible for unloading all running sessions first using the Session links (see next section). Once unloaded the update operation is identical.

u

u

MaintMode

Releases all but one of the Automation servers from memory. This is very useful for doing maintainence tasks that require exclusive access to tables when running more than 1 server instance for a particular application.

u

 

HoldRequests

Forces the DLL to return 'Please wait...' message page for all users and unloading all COM servers if running in COM mode, essentially locking down the Web Connection server except for users logged in under the AdminAccount list.  This can be used to update files on the server including Automation Server executables. This flag is a toggle that switches between on/off modes.

u

u

MaintHoldRequests

Works just like HoldRequests except it also loads a single COM Server instance so you can perform maintenance operations using the Web Connection server. When through use HoldRequests to toggle the HoldRequest flag back to off.

u

 

RecoverDeadLock

Manually overrides the HoldRequests flag in case you set it and can't access the maintainence page when not logged in. This setting also resets the spin and lock counts shown in the DLL Status page in the rare event that these value stay above 0 for extended periods.

u

 

ReadSetupIni

Re-reads the settings from the DLL startup INI file.

u

u

SetFileMechanism

Switch the DLL from Automation to File based message processing.

u

 

SetAutoMechanism

Switch the DLL from File based to Automation message processing.

 

u

KeepAlive

This request fires all of the Automation servers currently loaded. You can use this link to keep alive servers from Web Monitor by hitting it every 2 minutes. IIS unloads low usage threads after approximately 8 minutes and this allows keeping servers running. Servers are hit only if idle for more than 1 minute.

u

 

 

Online Code Updates

Updating code online without shutting down the Web server is possible with Web Connection when operating under COM with the Web Connection Pool Manager. The idea is that you upload your new executable to the server into a temporary location and then use an update link to actually copy the new file over the existing version. It's not quite so easy however, as you have to make sure all other sessions of the EXE are terminated before updating the file. This is easy to do with COM operation, but quite messy and potentially risky with file based operation.

The first thing you have to do is set up the wc.ini keys EXEFile and UpdateExe. The EXEfile should point at your executable file, while the UpdateExe should point at the new EXE file that you will upload to the Web server. It's very important that the Admin account that you use when you click the link (and is set up as the AdminAccount key in wc.ini) has access rights to read the file from the source directory and write access in the target.

To actually update the files:

COM Messaging
With Automation the process is actually automated. Assuming you have the files in the correct location all you have to do is click Update Code on the maintainence page and all servers are shut down for you and the files copied. Once complete the servers are restarted for you. You use the UpdateExe and ExeFile keys in the wc.ini file to swap out files in real time.

File Based Messaging
File based is more difficult as the ISAPI DLL has no control over the server instances. Instead you have to first kill all server instances by using wc.dll?wwMaint~Sessions~KillUnconditional until ALL sessions have been killed from the server. You can then click the Update EXE link. Once the files have been updated you now have no sessions running. In order to start a session you have run the Emergency Restart Exe file link on the maintainence page. This will start up the EXE specified in the EXEFile key of wc.ini. Note that this server will run invisibly on the NT desktop – it will be visible only in task manager (or if you have your Web server set up in the Service Manager to 'Interact with Desktop').

 



See also

The wc.ini configuration file | The wwMaint Maintainance requests | Web Connection ISAPI Error log (wcErrors.txt)


  Last Updated: 2/24/2008 | © West Wind Technologies, 2008