Web Page & WebService Threading Example

Web Page & WebService Threading Example

am 22.04.2008 21:00:43 von Peter

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

Re: Web Page & WebService Threading Example

am 22.04.2008 22:01:54 von Aidy

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.

"Peter" wrote in message
news:%23R0vrsKpIHA.4928@TK2MSFTNGP04.phx.gbl...
>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
>
>
>
>

RE: Web Page & WebService Threading Example

am 22.04.2008 22:08:16 von pbromberg

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


"Peter" wrote:

> 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
>
>
>
>

Re: Web Page & WebService Threading Example

am 22.04.2008 22:42:04 von Peter

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.



"Peter Bromberg [C# MVP]" wrote in message
news:74C2BACC-784A-4C22-9BC0-8627BF2609BA@microsoft.com...
> 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
>
>
> "Peter" wrote:
>
>> 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
>>
>>
>>
>>

Re: Web Page & WebService Threading Example

am 22.04.2008 22:43:28 von Peter

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.


"Aidy" wrote in message
news:ROudnUcVUMSs2ZPVnZ2dneKdnZydnZ2d@bt.com...
> 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.
>
> "Peter" wrote in message
> news:%23R0vrsKpIHA.4928@TK2MSFTNGP04.phx.gbl...
>>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
>>
>>
>>
>>
>
>

Re: Web Page & WebService Threading Example

am 23.04.2008 05:12:55 von stcheng

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/de fault.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"
>References: <#R0vrsKpIHA.4928@TK2MSFTNGP04.phx.gbl>

>Subject: Re: Web Page & WebService Threading Example
>Date: Tue, 22 Apr 2008 15:43:28 -0500
>Lines: 49
>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.
>
>
>"Aidy" wrote in message
>news:ROudnUcVUMSs2ZPVnZ2dneKdnZydnZ2d@bt.com...
>> 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.
>>
>> "Peter" wrote in message
>> news:%23R0vrsKpIHA.4928@TK2MSFTNGP04.phx.gbl...
>>>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
>>>
>>>
>>>
>>>
>>
>>
>
>
>

Re: Web Page & WebService Threading Example

am 23.04.2008 05:45:52 von Peter

Thank you very much!

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


"Steven Cheng [MSFT]" wrote in message
news:Ilg92$OpIHA.1788@TK2MSFTNGHUB02.phx.gbl...
> 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/de fault.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"
>>References: <#R0vrsKpIHA.4928@TK2MSFTNGP04.phx.gbl>
>
>>Subject: Re: Web Page & WebService Threading Example
>>Date: Tue, 22 Apr 2008 15:43:28 -0500
>>Lines: 49
>>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.
>>
>>
>>"Aidy" wrote in message
>>news:ROudnUcVUMSs2ZPVnZ2dneKdnZydnZ2d@bt.com...
>>> 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.
>>>
>>> "Peter" wrote in message
>>> news:%23R0vrsKpIHA.4928@TK2MSFTNGP04.phx.gbl...
>>>>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
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>