MSScriptControl randomly fails when running from .Net code on IIS
am 26.07.2007 17:14:02 von SteveWWe have been seeing an unusual and intermittent problem with some .Net 1.1
..aspx pages running on IIS 4.0 on a pair of load-balanced Windows 2000 SP4
servers. Basically we are using the class MSScriptControl (v.1.0 Interop
DLL) in our code to load and run custom VBScript dynamically on pages. This
has been working fine for years until the last few weeks when we have been
getting periods of a few days where the AddCode() method just throws an
exception unexpectedly. This is very strange as we havenât changed anything
in the build.
What is even stranger, is that when it is failing, we can run a test windows
application on the same server that will load and run exactly the same script
in exactly the same way, while the .aspx page doing the same thing on IIS
always fails...and then all of a sudden everything is working fine again!
System specs:
IIS 4.0
Windows 2000 (5.00.2195), Service Pack 4
.NET Framework v1.1.4322
Here is the code in question:
------------------------------------------------------
m_ScriptControl = new MSScriptControl.ScriptControlClass();
m_ScriptControl.Language = "VBScript";
m_ScriptControl.AllowUI = false;
m_ScriptControl.UseSafeSubset = true;
String sBase = this.m_Survey.ServerObjectModel;
sBase += "\n" + m_Survey.GetServerVBScriptObjectModel();
try
{
m_ScriptControl.AddCode( sBase );
}
catch
{
m_sError = "Failed to parse survey object model. \n" +
m_ScriptControl.Error.Source + "\nLine: " + m_ScriptControl.Error.Line + ".
Col: " + m_ScriptControl.Error.Column + ".\n" +
m_ScriptControl.Error.Description + "\n" + sBase;
m_ScriptControl = null;
}
--------------------------------------------
When the AddCode() method fails, we always get error at line 0, column 0,
with empty strings for the Error.Source and Error.Description properties.
Itâs almost as if something is stopping this method from executing, which
leads me to suspect the anti-virus software, which is McAfee VirusScan
Enterprise + Anti-Spyware Module 8.0.0.
Any thoughts on this problem would be greatly appreciated.
Thanks,
Steve