delegate in asp.net

  • Thread starter Thread starter DAXU
  • Start date Start date
D

DAXU

Hello,

I have a web page which sends 40-50 requests to a web service, which
in turn should return me some data. However, recently the web service
(out of my control) has been really slow and I keeps on getting error
messages (e.g. sql timeout) from the web service.

I am thinking of as soon as I receive the error message from the web
service, I will abandon further web service requests. However, the way
I did before was to create a delegate and use begininvoke to send the
request (the reason is that I can send more requests asynchronously to
speed things up.
e.g. like this:
GetProductBrandCoverageAsync _GetProductBrandCoverageAsync = new
GetProductBrandCoverageAsync(_WsMamSoft.GetProductBrandCoverage);
_GetProductBrandCoverageAsync.BeginInvoke
(_ProductBrandCoverage, Model, new AsyncCallback
(InsertModelProductBrandCoverage), _GetProductBrandCoverageAsync);


as a result, all the requests were sent before any results coming
back.
My question is, when a result indicating error comes back, how can I
ignore further return? or how can I kill these delegates?
I tried to have a bool value and just return when it set to true.
However, the web page still keeps on loading until all the
asynchronoused calls finished.

So what are my options?

Many Thanks

Jerry
 
keep a list of the webservice proxies you are calling. as soon as one fails,
loop thru the list and call the Abort method. this will cause the complete
routines to called with an error.

-- bruce (sqlwork.com)
 
Back
Top