Symptom: I'm trying to run Web Connection as a Service or at least run it so that no user needs to be logged on.
One topic that frequently comes up is how to set up Web Connection so that servers automatically start when the system boots up. Most people want WC to run as a service as a result of that. While it is possible to run WC as a service (using the NT ResKit's SvrAny program) I don't recommend this operation because the server cannot be controlled using the Web Connection server management features.
However, there are other more efficient ways to accomplish this task. Depending on whether you run COM or File based there are several mechanisms available:
Com Messaging
When running COM, Web Connection brings up Automation servers automatically when a link that requires a WC server is hit. You can even have Web Connection servers autoamtically load before anyone is logged onto the system by not using the Interactive account for Impersonation of the COM server. This is done using the Windows DCOMCnfg (part of Component Services) utility.
If you're always logged on under NT
If you're logged on under NT you should configure your Automation server to the Impersonate the Interactive User using the DCOMCnfg options (as described in OLE Automation Setup). Using this account allows the best operation of WC Automation servers that live visibly on the NT Desktop.AutoLogon to NT/2000/.Net Servers
A simple way to allow proper operation of WC is to use the above settings and force NT to automatically log in at boot up.Web Connection provides a utility in the via the Web Connection menu under Tools to create an AutoLogon entry in the registry for you or you can use the Management Console with the following code:
DO Console WITH "AUTOLOGON"To manually configure this option in the registry set the following registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
AutoAdminLogon REG_SZ 1 - AutoLogon 0 - Manual Logon DefaultPassword REG_SZ The accout password DefaultUsername REG_SZ The account nameRunning without an NT Logon
COM servers can run without having an NT logon. The default configuration is to run under Interactive which logs on to the local Console. However, you can configure your server very simply to either use the calling processes security context or by configuring a specific acccount which allows running without any login. The account you choose should have sufficient rights to access all resource your application might require.The easiest is to simply use pass through security from the calling process, which typically will be the IIS worker process or Application Pool (w3wp.exe). It's optimal for Web Connection to run using the local system account and if this account is used it's the best choice for running without a logon. One limitation of the System account is that it has no network rights so if you need to access files on network shares or possibly connect to a remote SQL server system may not work.
You can also set up your server to run under a specific account in which case DCOM will impersontate that specific account on every request. To do this go into DCOMCNFG and find your COM server in the list of servers and assign the specific user and password.
This user should have rights to access your data directories, TEMP and any remote SQL or network connections that your app may need (since this user is tied to your server it's OK to use an Admin account here!). Select your specific server within the DCOMCnfg and click on the Identity tab. Choose This User: and enter a valid account and password. I recommend you use an Admin account so you have full access to the machine/network via the Automation server.
Test the server with your custom DCOM account with a logon first to make sure it works! The server will not be visible because it now runs as part of the IIS Service context. However, it should still serve requests just fine. Since the server is invisible you might also want to adjust the startup INI settings to surpress the server form (ShowServerForm=Off) - no need for this overhead. Once you're sure the server runs with this account, restart the Web Service (to unload everything) and log off the machine. The server should continue to work at this point. If these settings work your application is ready for running as part of the IIS Service and acts like a system service.
Note: When your server is configured as using a specific account or Launching User the Web Connection server runs invisibly regardless of the Interact with Desktop flag of the Web service.
File Based
When running file based servers do not start up automatically as the Web Connection servers are standalone Visual FoxPro applications.
AutoLogon to NT and Startup Group entries
The easiest way to force WC servers to start up is to use Autologon (as described above) and server entries in the startup group. When the machine boots the startup group fires off servers automatically.The StartFileInstances flag in wc.ini
You can automatically start Web Connection server instances the first time a call to wc.dll is made by specifying the following two keys in wc.ini:ExeFile=c:\wwapps\wc2\wcdemo.exe FileStartInstances=2Servers started in this fashion can be auto-started before NT logon, but the servers will run invisibly. When you do log on the servers will become visible.