Date:  09/07/2016 04:01:16 PM Msg ID:  004846
From:  FoxWeb Support Thread:  004844
Subject:  Re: FoxWeb/FoxPro Process Control?
I would not be able to help you diagnosing the issue with the DLL, but you may be able to trap this error and get the channel to restart. Of course this is only possible if FoxWeb's error handler is catching and logging these errors. Did you get the "OLE error code 0x80131522: Unknown COM status code." string from the FoxWeb error log? If yes, then you can proceed.
To trap and change handling of this particular error, you will need to specify a custom error template in the FoxWeb Control Center. FoxWeb already provides a script named ErrHandler.fwx, which can be used as a starting point. This script receives the following parameters:
errnum, message, line_no, line, program
What you will need to do is insert code at the top of the script (right under the LPARAMETERS statement, which checks the parameters to determine if the error is the OLE error in question and asks the channel to restart itself. The example below checks based on the error message, but you could use any combination of the parameters: 

LPARAMETERS errnum, message, line_no, line, program


* Start of custom code


IF message = "OLE error code 0x80131522: Unknown COM status code."

    M.FW_Restart = 2



* End of custom code 


Response.Clear && Clear response buffer



<!-- ">" --></p>

... rest of ErrHandler.fwx 

 Setting FW_Restart to a value of 2 from any script forces the channel to restart as soon as it is finished returning the response to the browser.
FoxWeb Support Team email
Sent by Keith Raker on 09/07/2016 05:20:51 AM:
 FoxWeb Version:  4.5
We have a scenario where we have developed a COM object/DLL using .NET that we need to access (for legacy integration purposes) from a FoxWeb script.  Unfortunately, for some reason, after some FoxWeb Stop/Starts (or server restarts) at least one of the FoxWeb channels/processes have come up in a state where they are unable to instantiate the COM object.  We are getting the following errors:
OLE error code 0x80131522: Unknown COM status code.
We have done extensive troubleshooting, and are not yet able to determine why an individual process/channel can't instantiate the object when another one can.  Note that we can kill the individual process with the issue, and it automatically restarts and works successfully afterwards. 
First, does anyone have an idea what might be causing this problem after a FoxWeb stop/start?  Second, is there any way for a FoxWeb script to "signal" to the error handler that the currently running process is "bad" and needs to be restarted?  We have FoxWeb set to Reset Channels, but it doesn't seem to do this even when the script throws an exception/error. 
Any thoughts/help on this would be great.