[Mono-dev] Threading issues in page_load event (in ASP.NET on mono)
Arun
arunarun2000 at gmail.com
Wed May 30 02:03:27 EDT 2007
Hi guys
I am trying to run an asp.net application on mono. Please see whether
you can help me out with the following problem.
I am using a seperate thread to query a remote database, in the page
load event of an aspx page.
I am using this since it might take a really long time, for the query
to return to return some results.
So in another thread, I am monitoring how long it is taking to finish.
If it taking more that 180 seconds, then I am aborting the query
thread and printing error message accordingly.
But if i run this on mono, I am getting a plain blank white page.
(script timeout !!??)
Also in the log I am seeing the "Trigerring Pageload.." message
multiple times even when I opened the page only once !!
I have included the code, below.
private void Page_Load(object sender, System.EventArgs e)
{
log.Debug("Trigerring Pageload..");
Server.ScriptTimeout=600;
ts_start = new ThreadStart(start_process);
thread_starter = new Thread(ts_start);
if(thread_starter.IsAlive != true)
{
thread_starter.Start();
}
else
{
show_webserver_error();
return;
}
int i = 0;
while(thread_starter.ThreadState !=
ThreadState.Stopped)
{
System.Threading.Thread.Sleep(20000);
i++;
if(i > 8)
{
finish_process();
log.Debug("Query Aborted");
thread_starter.Abort();
return;
}
}
}
More information about the Mono-devel-list
mailing list