I have System.Web loaded as an assembly in the database called
"SystemWeb".
When I first set it up, load all the CLR assemblies, create the
procedure, and run it, everything is fine.
When I call the procedure again using different input arguments
(though with the exact same code running through the exact same path),
I get this error: "System.IO.FileNotFoundException: Could not load
file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified."
This is in the constructor of an object that initializes some mail
variables (such as to: from: subject: mail server).
After I restart the server and/or drop and reload all SQL/CLR
assemblies to clean things up...
If I call this procedure with 'A' as an input parameter, it will run,
but then if I call it with 'B' as an input parameter, it fails with
this error.
If I call this procedure with 'B' as an input parameter, it will run,
but then if I call it with 'A' as an input parameter, it fails with
this error.
If I always call it with the same parameter, it always works.
My question is...what could be causing this exception? The System.Web
assembly is there loaded in the database...why is it not finding it?
Could memory pressure somehow keep this assembly from loading,
spawning a "File Not Found" error, even though that's not the real
error?
Why do I only get the error if I change parameter values? Could this
be due to some caching that SQL Server is doing behind the scenes?