J
Jim Macbeth
Hi,
We have some code that converts uploaded files from the uploaded type
(word doc etc) to Text and HTML.
The code is as follows:
// Create new thread with STA ApartmentState to invoke the COM objects
Thread cft = new Thread(new ThreadStart(convertFileThread));
cft.ApartmentState = ApartmentState.STA;
cft.Name = "ConvertTo" + destinationType;
convertState = ConvertState.Started;
sThreadMessage = "Could not start conversion thread";
cft.Start(); // Do it
cft.Join(300000); // Wait a maximum of convertTimeout milliseconds
(300000 miliseconds = 5 mins)
if (convertState == ConvertState.Completed)
{
return null;
}
else if (convertState == ConvertState.Running)
{
return string.Format("File conversion could not complete in {0}
seconds", (convertTimeout/1000));
}
else
{
sThreadMessage += "(convert state: "+convertState.ToString()+", thread
state: "+cft.ThreadState.ToString()+")";
return sThreadMessage;
}
This works fine on all servers we have installed the code on except one.
On that server the convertFileThread delegate function never starts. The
code runs through to the last else clause and returns
the following error:
Could not start conversion thread (convert state: Started, thread state:
Stopped)
Is there anything in asp.net that prevents client threads from starting?
Please note that this isn't my code. I have inherited it.
Anyway I am well confused so any help would be most appreciated.
The server having the problem and others that this code works fine on are
running .NET v1.0.3705
Thanks in advance,
Jim
We have some code that converts uploaded files from the uploaded type
(word doc etc) to Text and HTML.
The code is as follows:
// Create new thread with STA ApartmentState to invoke the COM objects
Thread cft = new Thread(new ThreadStart(convertFileThread));
cft.ApartmentState = ApartmentState.STA;
cft.Name = "ConvertTo" + destinationType;
convertState = ConvertState.Started;
sThreadMessage = "Could not start conversion thread";
cft.Start(); // Do it
cft.Join(300000); // Wait a maximum of convertTimeout milliseconds
(300000 miliseconds = 5 mins)
if (convertState == ConvertState.Completed)
{
return null;
}
else if (convertState == ConvertState.Running)
{
return string.Format("File conversion could not complete in {0}
seconds", (convertTimeout/1000));
}
else
{
sThreadMessage += "(convert state: "+convertState.ToString()+", thread
state: "+cft.ThreadState.ToString()+")";
return sThreadMessage;
}
This works fine on all servers we have installed the code on except one.
On that server the convertFileThread delegate function never starts. The
code runs through to the last else clause and returns
the following error:
Could not start conversion thread (convert state: Started, thread state:
Stopped)
Is there anything in asp.net that prevents client threads from starting?
Please note that this isn't my code. I have inherited it.
Anyway I am well confused so any help would be most appreciated.
The server having the problem and others that this code works fine on are
running .NET v1.0.3705
Thanks in advance,
Jim