Hello folks, the below code is working fine on my local machine and also worked fine for 2months on the server. since a few days, the code on the server is NOT WORKING AFTER 45 MINUTES FROM THE START OF THE TIMER. im seeing this issue since 2 weeks, the same code for other methods , which use webservices is working fine. am i doing correct with http get? can someone please let me know waht the issue could be. thanks in advance.
Private dtmA_SentLast As DateTimeinitiaize:dtmA_SentLast = Date.Now.AddHours(-1) when the timer is first started...
Dim tsA As TimeSpan tsA = Date.Now.Subtract(dtmA_Sentlast) If tsA .Minutes >=5 Then ----after 45 minutes this is stopped and not getting data If blnSentA = False Then ID = GetHttpData() dtmA_Sentlast = dtmNow blnSentA = True End If Else blnSentA = False End If---GetHttpData() function:
Dim objProxy As WebProxy Dim strResultXML As String Dim policy As HttpRequestCachePolicy Dim myHttpWebResponse As HttpWebResponse Dim myHttpWebRequest As HttpWebRequest Try objProxy = New WebProxy(ProxyIP, ProxyPort) objProxy.BypassProxyOnLocal = True
If ProxyAuthRequired = True Then _ objProxy.Credentials = New NetworkCredential(ProxyUsername, ProxyPassword) ''''' policy = New HttpRequestCachePolicy(HttpCacheAgeControl.MaxAge, TimeSpan.FromMinutes(5)) --data gets updated every 5 minutes myHttpWebRequest = CType(HttpWebRequest.Create(pstrUri), HttpWebRequest) myHttpWebRequest.Credentials = New NetworkCredential(pstrUsername, pstrPassword) myHttpWebRequest.CachePolicy = policy myHttpWebRequest.Method = "GET" myHttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse) Using sr As StreamReader = New StreamReader(myHttpWebResponse.GetResponseStream, System.Text.Encoding.Default) strResultXML = sr.ReadToEnd().Trim().ToString() myHttpWebResponse.Close() End Using Finally ' End Tryv