[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Ron Vecchi

12/27/2002 5:42:00 AM

I have a web method that I would like to call. The catch is, if the service
is down or otherwise not running for some reason I would like my aspx
page(vb.net) to only try to connect to the web service for say, 10 seconds.
Then if no response it would abort the connection and I could handle the
rest in the aspx page.

I am understanding that I need to call the web method asyncronously, but I
am still having problems with the time it will try to connect for. It is
trying for a lot longer than I specify in my code(below)
-------------------------------------------------
'''''''''''''''''''' Initialize custom object to be returned from web
service
Dim rrc As New localhost.RegistrationResponseContainer()
'''''''''''''''''''' Initialize object to be passed through soap header
Dim rav As New localhost.RegistrationAuthenticator()
'''''''''''''''''''' Set URL of webservice
_WS.Url = NetworkData.AuthenticationServiceUrl
'''''''''''''''''''' Set object to soap header
_WS.RegistrationAuthenticatorValue = rav

Try
'''''''''''''''''''' connect to service asycronously

Dim ar As IAsyncResult = _WS.BeginRegister(Nothing, Nothing)
ar.AsyncWaitHandle.WaitOne(10000, False)
rrc = _WS.EndRegister(ar)

-------------------------------------------------

To my understanding the webservice connection should only try and connect
for 10000 milliseconds, but it is going on for much longer, I usually end up
hitting the stop button on the browser as it seems that it would go on
forever.

Everything with the webservice is fine and working. The webservice is
running on a different local machine and I have stoped the parent website in
IIS to test the webservice as if it went unexpectedly down. I am connecting
and retrieveing the right results when it is running. i am just having
trouble with the time allocated to connect to it.

Thanks in advance
Ron Vecchi