Date:  09/08/2016 03:44:09 AM Msg ID:  004847
From:  Keith Raker Thread:  004844
Subject:  Re: FoxWeb/FoxPro Process Control?
Thanks so much for the info!  This is great to know.  Currently, the script that is experiencing the error has a TRY/CATCH block around instantiation of the COM object and the code is attempting to handle it in the CATCH block.  
So, if I understand correctly, and we left our current error handling in the script,  we should be able to set M.FW_Restart = 2 where we are CATCHing the error, and the channel/VFP process should restart right after the data/page is returned to the browser?  We could also move to custom error handling as you mentioned.  Just wanted to see if I understood that about setting M.FW_Restart = 2 in any script.
Thanks again for the help!

Sent by FoxWeb Support on 09/07/2016 04:01:16 PM:
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.