Hi,
I am using a STA thread to run a COM object.
On a couple of machines the thread runs fine. On another machine the thread
won't start, and no exceptions are thrown.
This code is running in a web service implemented using C#, ASP.NET 1.1, IIS
5.1, Windows 2000 Server.
Any suggestions appreciated! Here is some code. The method
xmlLoader.Load( ) is never invoked.
To start the thread:
XmlBulkLoader xmlLoader = new XmlBulkLoader() ;
ThreadStart workThreadDeleg ate = new ThreadStart(xml Loader.Load);
Thread workThread = new Thread(workThre adDelegate);
workThread.Apar tmentState = ApartmentState. STA;
workThread.Name = "XMLBulkLoader" ;
workThread.Star t();
workThread.Join ();
The code that is not running when it should (xmlLoader.Load ):
public class XmlBulkLoader
{
public void Load()
{
ADODB.Stream xmlDataStream = null;
try
{
xmlDataStream = new ADODB.StreamCla ss();
xmlDataStream.O pen(System.Type .Missing,
ADODB.ConnectMo deEnum.adModeUn known,
ADODB.StreamOpe nOptionsEnum.ad OpenStreamUnspe cified,
null, null);
xmlDataStream.W riteText(_xmlDa ta, ADODB.StreamWri teEnum.adWriteC har);
xmlDataStream.P osition = 0;
SQLXMLBulkLoad3 objBL = new SQLXMLBulkLoad3 ();
objBL.Connectio nString=_dbConn ection;
objBL.ErrorLogF ile = Path.Combine(_l ogFilePath, "sqlbulkloaderr or.log");
objBL.CheckCons traints = true;
objBL.Transacti on = true;
objBL.XMLFragme nt = false;
objBL.SchemaGen = false;
objBL.KeepIdent ity = false;
objBL.KeepNulls = false;
objBL.IgnoreDup licateKeys = false;
objBL.ForceTabl eLock = false;
objBL.SGDropTab les = false;
objBL.Execute(_ schemaFile, xmlDataStream);
}
catch(Exception ex)
{
exception = ex;
}
finally
{
if (xmlDataStream != null)
{
xmlDataStream.C lose();
}
}
}
}