[Mono-dev] Threading issues in page_load event (in ASP.NET on mono)
arunc3
arunarun2000 at gmail.com
Wed May 30 10:37:33 EDT 2007
True.
When the thread is taking longer to execute than the script timeout value,
it is automatically aborted.
But, won't the users see a plain blank page w/o any messages, if the code
times out?
I want to show a decent message, if the thread is taking too long!
Interestingly this code works *perfectly* on a windows box on IIS. But not
on mono.
:(
Rafael Teixeira wrote:
>
> AFAIR, ASP.NET already does that for you, you can just configure the
> timeout period, don't reinvent the wheel, please.
>
> :)
>
>
>
> On 5/30/07, Arun <arunarun2000 at gmail.com> wrote:
>> 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;
>> }
>> }
>>
>> }
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>
>
> --
> Rafael "Monoman" Teixeira
> ---------------------------------------
> "The reasonable man adapts himself to the world; the unreasonable one
> persists in trying to adapt the world to himself. Therefore all
> progress depends on the unreasonable man." George Bernard Shaw
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
--
View this message in context: http://www.nabble.com/Threading-issues-in-page_load-event-%28in-ASP.NET-on-mono%29-tf3838407.html#a10875080
Sent from the Mono - Dev mailing list archive at Nabble.com.
More information about the Mono-devel-list
mailing list