473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is it ok to run another thread inside the page then come back

I used a web service (or dll) to create a socket/send some data in a
thread within a function in a page. After this operation, the
operation in this page continues. This approach works when the page
starts. But it often fails after running this thread a few times. The
error I got is as follows:

Server Application Unavailable
The web application you are attempting to access on this web server is
currently unavailable. Please hit the "Refresh" button in your web
browser to retry your request.

Administrator Note: An error message detailing the cause of this
specific request failure can be found in the application event log of
the web server. Please review this log entry to discover what caused
this error to occur.

==========================
The error message in the event log is "aspnet_wp.exe (PID: 3960)
stopped unexpectedly".

I doubt that this was due to the statelessness of the HTTP protocol,
since this will not happen in a desktop application. Am I right?

In order to make this operation more reliable, can I use Session
variable or Viewstate to save something before call this thread then
recover afterwards? I did try once but seems no effect. Please help.
Thank you for your time.

Feb 22 '07 #1
4 1224
"charles" <ch**********@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
>I used a web service (or dll) to create a socket/send some data in a
thread within a function in a page.
This is almost certainly a mistake, since you don't appear to understand the
ASP.NET execution model.

Any thread that you create during the execution of a page may possibly
continue execution after the end of the request that created the page. If
you don't know what you're doing, you're almost certainly going to see some
interesting failures.

I suggest you see the article in this month's MSDN magazine on asynchronous
execution.

John
Feb 22 '07 #2
Ray
To access web services async, it's best to use the Begin*
End* methods in the proxy, ie use asychronous calls instead
of creating your own threads and sockets.

"charles" <ch**********@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
I used a web service (or dll) to create a socket/send some data in a
thread within a function in a page. After this operation, the
operation in this page continues. This approach works when the page
starts. But it often fails after running this thread a few times. The
error I got is as follows:

Server Application Unavailable
The web application you are attempting to access on this web server is
currently unavailable. Please hit the "Refresh" button in your web
browser to retry your request.

Administrator Note: An error message detailing the cause of this
specific request failure can be found in the application event log of
the web server. Please review this log entry to discover what caused
this error to occur.

==========================
The error message in the event log is "aspnet_wp.exe (PID: 3960)
stopped unexpectedly".

I doubt that this was due to the statelessness of the HTTP protocol,
since this will not happen in a desktop application. Am I right?

In order to make this operation more reliable, can I use Session
variable or Viewstate to save something before call this thread then
recover afterwards? I did try once but seems no effect. Please help.
Thank you for your time.

Feb 22 '07 #3
On Feb 22, 3:45 pm, "Ray" <notth...@63.netwrote:
To access web services async, it's best to use the Begin*
End* methods in the proxy, ie use asychronous calls instead
of creating your own threads and sockets.

Thank you, Ray. I am very interested in your suggestion. Would you
please talk in more details? How to use these methods to communicate
with outside programs?

Regards,

Charles
2/22

Feb 22 '07 #4
Ray
It's best done using the callback method.
http://msdn2.microsoft.com/en-us/library/wyd0d1e5.aspx

BTW, the same thing can be done to any function, not
just web services methods, using delegates. Every delegate
has Begin* and End* methods for async invocation.
"charles" <ch**********@yahoo.comwrote in message
news:11*********************@q2g2000cwa.googlegrou ps.com...
On Feb 22, 3:45 pm, "Ray" <notth...@63.netwrote:
To access web services async, it's best to use the Begin*
End* methods in the proxy, ie use asychronous calls instead
of creating your own threads and sockets.


Thank you, Ray. I am very interested in your suggestion. Would you
please talk in more details? How to use these methods to communicate
with outside programs?

Regards,

Charles
2/22

Feb 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: Charles Law | last post by:
Hi guys. I'm back on the threading gig again. It's the age-old question about waiting for something to happen without wasting time doing it. Take two threads: the main thread and a worker...
6
by: Tony Proctor | last post by:
Hi everyone We're experiencing some serious anomalies with the scheduling of ASP threads. I'd be interested to hear if anyone knows what algorithm is used (e.g. simple round-robin, or something...
2
by: Johann Blake | last post by:
The following is a bug I have discovered using tab pages and threads and I am looking for a workaround. Create a new Windows Forms application and add a tab control with two tab pages. Add a...
6
by: Joe Jax | last post by:
I have an object that spawns a worker thread to process one of its methods. That method processes methods on a collection of other objects. During this processing, a user may request to cancel the...
5
by: Torben Laursen | last post by:
Hi My interface calls a C++ dll that runs a slow calculations. So I call the dll inside a BackgroundWorker thread, and that all works fine. But how can I stop the thread if the user wants to?...
4
by: Totto | last post by:
Hi, I'm doing a server.transfer from a click event of a button, but an exception is raised with "Thread was being aborted" Anyone know why? Thanks Tor
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
7
by: reyesflaco | last post by:
I am developing an application using asp.net 2.0. I created all my business objects in my app_code folder. As of right now, all my classes are public. In my aspx pages, I am declaring the class...
12
by: Ronny | last post by:
Thanks Chris, Looks nice but I miss the dual way communication. In the main thread to deliver paramters and data to the worker thread- how can I do that? Regards Ronny Take a look at the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.