vb.net - Timeout: The underlying connection was closed: The connection was closed unexpectedly -
i having timeout issue. service connecting works fine when responds in timely fashion. when takes around 10 seconds, times out exception. besides timeout , readwritetimeout, other timeout properties can set waits properly? there need set @ tcp/ip level? help.
system.net.webexception: underlying connection closed: connection closed unexpectedly. @ system.net.httpwebrequest.getresponse()
here code. have tried variations of many things:
'the post works dim _httprequest httpwebrequest _httprequest = webrequest.create("mywebservice") system.net.servicepointmanager.expect100continue = false _httprequest.credentials = credentialcache.defaultcredentials _httprequest.protocolversion = httpversion.version10 'this 60 second wait _httprequest.timeout = 60000 'this 60 second wait _httprequest.readwritetimeout = 60000 _httprequest.keepalive = false _httprequest.method = "post" 'if response takes takes 10 seconds 'this message get: system.net.webexception: underlying connection closed: connection closed unexpectedly. _httprequest.method = "get" _httprequest.contenttype = "text/xml" 'the error here dim httpresponse httpwebresponse = _httprequest.getresponse
the timeout value setting 60000, translates 1 minute, since timeout value in milliseconds. value of 1000 1 second. try setting appropriately higher value. e.g. try setting 5 or 10 minutes test.
Comments
Post a Comment