SCGI on Windows
While developing with Woof!, you can simply directly start Woof! as an SCGI server by directly invoking the Woof! SCGI server script. For example, the following console command in the Woof! root directory c:\myapp
c:\myapp> tclsh lib\woof\webservers\scgi_server.tcl
starts Woof! listening on the default port 9999, or
c:\myapp> tclsh lib\woof\webservers\scgi_server.tcl -port 10000
will start it on a non-default port 10000.
To stop the server, simply hit Ctrl-C.
Running Woof! as a Windows service
|NOTE||To run Woof! as an Windows service, the TWAPI package must be installed.|
To run Woof! in production mode, where the Woof! process must be running independently of anybody being logged in, it must be installed as a Windows service using the scripts\scgi_winservice.tcl script. For example,
c:\myapp> tclsh scripts\scgi_winservice.tcl -service woofscgi install
will install Woof! as a Windows service
can use the standard Windows service control commands, such
net stop and
net start to control the service.
In addition to the service name, you can also set the port and other
parameters. see the scgi_winservice - Woof! Windows service chapter for
Note you have to make sure the service is started by some means before the web server is ready to pass on requests. There are three possible ways to do this.
- Start it manually using the Windows
- Have it automatically started at system boot time. For this to happen,
you need to install the service with the
c:\myapp> tclsh scripts\scgi_winservice.tcl -service woofscgi -startup auto install
- Have it started on-demand by the web server. This is only possible with IIS and is described in the next section.
Starting Woof! SCGI from IIS
If your web server is Microsoft IIS and you are using
IIS extension, you can have IIS start the Woof! service
"on-demand". Configure the service to start in manual mode
as above. Then add the following two lines to
the isapi_scgi configuration
SCGIServerStartCommand= net start woofscgi SCGIServerStopCommand= net stop woofscgi
This assumes you have named the Woof! SCGI service
The first time that IIS receives a request to be sent to Woof!, it
will load the
isapi_scgi extension. As part of its
initialization, the extension will then execute the command specified
SCGIServerStartCommand variable to start the Woof!
SCGI server. Similarly, when IIS is stopped, the isapi_scgi extension
will invoke the command specified by
SCGIServerStopCommand variable to stop the Woof!
service. For more details, see
Uninstalling the Woof! service
If you no longer wish to run Woof! as a service, you can use the scgi_winservice.tcl script to uninstall it:
c:\myapp> tclsh scripts\scgi_winservice.tcl -service woofscgi uninstall
Setting the Woof! service user account
By default, the Woof! service will run under the Windows LocalService account. To change the account under which the service runs, specify the account name in the Log on pane in the property sheet for the service in Windows Service Control Manager. If you do this, make sure the account has access to the resources (file system, databases etc.) used by your Woof! application.
Because the Woof! libraries may not be loaded during startup, the Woof! service will log errors to the Windows event log in some cases, particularly during startup.