One question that frequently comes up is "How do I run the Web Connection servers on system startup?" Or "Can I run Web Connection as a Service?"

Web Connection can be started automatically on system startup, but it cannot run as a service since it is acutally a component that is called from IIS. There are a several ways to configure Web Connection run on startup.

COM Operation - Auto Logon on with a Windows Account

Under COM operation Web Connection servers are automatically launched the first time a request hits them, so effectively COM operation always auto-starts servers and acts like a service. When the Web Server is shut down any active instances are released. The account launched is determined by the COM Impersonation settings set up for your Web Connection server.

When auto-starting Windows and running without a Console logon the Web Connection Console is not visible - it'll run invisibly in the background and you can effectively turn off the user display (Showserverform=Off/Showstatus=Off). You also will need to configure the DCOM impersonation to NOT use the Interactive User account which can only run with a Console logon.

Do not use the Interactive User for Autologon scenarios
If you want COM servers to startup during system startup before anybody is logged on you need to insure that you are NOT using the Interactive User for DCOM Impersonation. The Interactive User is the only account you can run a COM Server under and get a visual display of the server window, but it will not properly launch when no one is logged on to the machine.

If you're running Web Connection under COM you can specify the impersonation of the COM server. This allows you specify exactly which account Web Connection runs under and this account can be any account that has rights to access the resources the application requires: Files, databases, network shares etc. You can use any Windows account, but do not use the Interactive User which is the default.

For more information on COM Impersonation Configuration see Manual Com Server Configuration.

File Operation - Auto Logon and hidden server instances

If you are running in File mode, auto-starting is a little more complicated. Starting instances is quite easy actually, but managing once they have started is more difficult because these instances are launched invisibly in the IIS server's context. Typically this means instances are launched under the SYSTEM account (or whatever impersonation the IIS Application Pool uses).

To set up your EXE server to autostart set up wc.ini as follows:

ExeFile=c:\wwapps\wc2\wcdemo.exe
FileStartInstances=2

This will launch two instances of the specified EXE file from within the Web Server's context hence these instances will be started invisibly and won't show on up on the desktop. Because the launched instances are standalone EXE files the instances will not be automatically removed when the application or the Web Server shuts down. Nor will new instances start up when one instance hangs or crashes - it's up to you to monitor and manage these servers. You can use the Administration page to see which servers are running.

For reliability in deployed applications we recommend you do not use file based operation. COM operation provides auto-startup and shutdown as well as crash recovery ensuring that your servers are always up and running.

For more information on File mode configuration please see Manual File Server Configuration.

Auto-Starting a Windows Console and Running Interactive Instances

Both of the above approaches hide the Web Connection console because they effectively run the Web Connection server in an invisible Windows Session rather than on the desktop Console session. For deployed applications this is the recommended approach as it ensures that the servers are available immediately before a Console is loaded and also when the machine is locked and no Console session is available.

However, some folks prefer to run in a visual setting and you can do this by running your servers in an interactive Windows Session.

COM Mode
In COM mode to get the server to run on the desktop the COM server has to be configured for the Interactive User in the DCOM configuration. Only the Interactive User setting in the DCOM Impersonation allows a visible Web Connection server console. In order for the server to work the Windows machine MUST BE logged on to the Console. If there is no log on, or the machine is locked the COM Server will fail to load. This approach is not recommended for deployed applications!

File Mode
File mode has no way to launch instances on the desktop via FileStartInstances mentioned in the previous section - these instances are always loaded in an invisible Windows session. This means you are responsible for loading file based instances - probably from an auto-start program group in Windows.

AutoLogon on Windows

If you do decide to visible instances of Web Connection you'll want to configure you server so that it automatically logs in on startup and the easiest way to do this is via an auto-logon.

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 name 


Com Mode Startup Problems on busy Sites
In auto-logon mode with COM, IIS starts much earlier than the Console and so you will likely get errors during the startup phase of the machine when IIS is trying to start the COM servers while the Console is not up yet.

Again, we don't recommend this approach as it is volatile and can result in servers not starting up properly especially in COM mode.