Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

Web Page & WebService Threading Example

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Peter - 22 Apr 2008 20:00 GMT
I have a Web page which calls a WebService, this web service call might take
few seconds to up 30 min
I was thinking of having a webpage query the webservice every minute to keep
it form timing out, but I am not sure how to do that,
somehow I have to have the webpage query the status of the Webservice
request every minute or so to keep it from timing out.

I was thinking to do the following:

1) Web page calls a webservice
2) A web service spans a thread and returns some thread id to the calling
webpage
3) The web page keeps calling the webservice with this thread id every
minute as long as the webservice confirms the thread is running, that way
the web page will not timeout
4) Once the thread is completed the web page calls the webservice again and
retrieves the final result.

Does anyone has an example of such process or a better idea of how this
should be done?

Thank you

Peter
Aidy - 22 Apr 2008 21:01 GMT
The webpage will time out even if it is active as IIS will determine that
the page is probably hanging or in a loop or just being a resource hog so
will want to get the thread back.  Basically you shouldn't call long running
tasks from a web page.  Want kind of access do you have over the server?
You could install something like a web service that did the long-running
call and exposed a way to query the progress to your site.

>I have a Web page which calls a WebService, this web service call might
>take few seconds to up 30 min
[quoted text clipped - 20 lines]
>
> Peter
Peter - 22 Apr 2008 21:43 GMT
That's what was saying in steps 1 thrugh 4, I just wondering if there's an
example or if someone has a better idea.

> The webpage will time out even if it is active as IIS will determine that
> the page is probably hanging or in a loop or just being a resource hog so
[quoted text clipped - 27 lines]
>>
>> Peter
Steven Cheng [MSFT] - 23 Apr 2008 04:12 GMT
Hi Peter,

From your description, what you want to do is implement an async pattern
for calling a long run webservice method from an ASP.NET web application.

Yes, I think the pattern you mentioned is workable. Your current idea is
make the async processing tracking (and status management) at the
webservice side. the client calling web application will pull the status
and result by keep calling webmethod from that webservice, correct?

Here is an MSDN article mentioned another pattern for processing such
long-run task in async mode:

#How To: Submit and Poll for Long-Running Tasks
http://msdn2.microsoft.com/en-us/library/ms979200.aspx

the idea in it is put all the async call and status polling(and management)
at client calliing side(asp.net application). You use the auto-generated
async webmethod (beginXXX and endXXX) to call the webservice asynchornouly
and use the callback handler to update status table. Also, you need a
polling page to constantly poll the status table to check whether a certain
task has finished. The advantage here is that it doesn't require your
server-side webservice to change much.

BTW, since your webservice execute long-run task, you may need to adjust
the timeout setting (for both server-side ASP.NET webservice application)
and the client-side webservice proxy so as to avoid timeout exception. Here
is a former thread where I've mentioned the related timeout settings:

#Timeout Calling Web Service
http://bytes.com/forum/thread425416.html

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Peter" <czupet@nospam.nospam>
>References: <#R0vrsKpIHA.4928@TK2MSFTNGP04.phx.gbl>
<ROudnUcVUMSs2ZPVnZ2dneKdnZydnZ2d@bt.com>
>Subject: Re: Web Page & WebService Threading Example
>Date: Tue, 22 Apr 2008 15:43:28 -0500
[quoted text clipped - 33 lines]
>>>
>>> Peter
Peter - 23 Apr 2008 04:45 GMT
Thank you very much!

Looks like the articles you provided is what I was looking for.

> Hi Peter,
>
[quoted text clipped - 108 lines]
>>>>
>>>> Peter
Peter Bromberg [C# MVP] - 22 Apr 2008 21:08 GMT
Yikes - waiting up to 30 minutes on a web page? Why not just send them an
email when it's done, with a link to download their stuff?
-- Pete
To be a success, arm yourself with the tools you need and learn how to use
them.

Site: http://www.eggheadcafe.com
http://petesbloggerama.blogspot.com
http://ittyurl.net

> I have a Web page which calls a WebService, this web service call might take
> few seconds to up 30 min
[quoted text clipped - 20 lines]
>
> Peter
Peter - 22 Apr 2008 21:42 GMT
The process creates reports so depending on what data you are querying
depends how long you wait.

For instance every day the user enters 'Smith' as the parameter and looks
for results, the report might take 5 seconds to run to display the data.
Then one day the user enters 'S*' and the report takes 20 minutes to run so
I can't tell the user to expect email sometimes and display it on the screen
other times specialy when the users want to see the results on the screen.

> Yikes - waiting up to 30 minutes on a web page? Why not just send them an
> email when it's done, with a link to download their stuff?
[quoted text clipped - 33 lines]
>>
>> Peter

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.