|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
webreq.getresponse exceptionsI have a programs that accepts TCPIP requests and processes them. A thread is created to handle each TCPIP connection. Part of handling the request is involves making a webrequest. webReq = Net.HttpWebRequest.Create(URL) webReq.Timeout = 60000 webResp = webReq.GetResponse This has been working fine for 6 months or more handling maybe 50 simultaneous requests but now the traffic has picked up substantially. It might be handling 150 requests simultaneously. I'm beginning to get exceptions thrown making the web request. I get either of these The operation has timed-out. The underlying connection was closed: The request was canceled. The operation has timed-out exception is probably because it went over 1 minute and I have to have some sort of timeout because the TCPIP request I got initially is waiting on it's reply and will not wait for long. I don't know if the second exception is something I can do anything about or if it is web server related. Any ideas? Hi cj,
Based on the code snippet you have provided, I didn't see the code that you're closing the underlying connection. Usually, people forget that the underlying connection created by the request is not freed up,unless you call Close() on the response. So, you hit the connection limit, and no more webrequests will go through. Please call Response.Close() to close it when it is used. You can check the following link for more information. http://blogs.msdn.com/feroze_daud/archive/2004/01/21/61400.aspx If this still doesn't help, you may be facing a performance issue for your ASP.NET app. Please check the following KB article for how to do performance tuning on this issue. http://support.microsoft.com/kb/821268/en-us Kevin Yu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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.) Kevin,
Yes, I close the connection. I only wanted to show the command I used to contact the server. Also I'm told the server I'm contacting has no set limit on it's connections. My program, this one we are talking about, is not ASP.NET. I guess you know that. It is just a Windows program. I believe the web server is running ASP.NET code and that could be the problem but I didn't write that program. If you have suggestions on what the problem could be on the web server side I can pass them on to the folks working on that program. Here a small section of my actual code. Try Dim webReq As Net.HttpWebRequest Dim webResp As Net.HttpWebResponse Dim URL As String = "http://192.168.168.142/validate/validate.aspx?" & _ iElement(3) & _ "&submit_by=R" & _ "&" & iElement(2) webRespStr = "" webReq = Net.HttpWebRequest.Create(URL) webReq.Timeout = 15000 Try webResp = webReq.GetResponse Catch ex As Exception LoopErrMsg += (deleted extra stuff here for this email) End Try webResp.Close() (deleted extra stuff here for this email) Catch ex As Exception LoopErrMsg += (deleted extra stuff here for this email) End Try Kevin Yu [MSFT] wrote: Show quoteHide quote > Hi cj, > > Based on the code snippet you have provided, I didn't see the code that > you're closing the underlying connection. Usually, people forget that the > underlying connection created by the request is not freed up,unless you > call Close() on the response. So, you hit the connection limit, and no more > webrequests will go through. Please call Response.Close() to close it when > it is used. > > You can check the following link for more information. > > http://blogs.msdn.com/feroze_daud/archive/2004/01/21/61400.aspx > > If this still doesn't help, you may be facing a performance issue for your > ASP.NET app. Please check the following KB article for how to do > performance tuning on this issue. > > http://support.microsoft.com/kb/821268/en-us > > Kevin Yu > Microsoft Online Community Support > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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.) > Ooops, I deleted a line by accident when removing extra junk from my
code to post. just before webresp.close() is the line webrespstr = new io.streamreader(webresp.getresponsestream).readtoend Sorry for the confusion. cj wrote: Show quoteHide quote > Kevin, > > Yes, I close the connection. I only wanted to show the command I used > to contact the server. > > Also I'm told the server I'm contacting has no set limit on it's > connections. > > My program, this one we are talking about, is not ASP.NET. I guess you > know that. It is just a Windows program. I believe the web server is > running ASP.NET code and that could be the problem but I didn't write > that program. If you have suggestions on what the problem could be on > the web server side I can pass them on to the folks working on that > program. > > Here a small section of my actual code. > > > Try > Dim webReq As Net.HttpWebRequest > Dim webResp As Net.HttpWebResponse > Dim URL As String = > "http://192.168.168.142/validate/validate.aspx?" & _ > iElement(3) & _ > "&submit_by=R" & _ > "&" & iElement(2) > > webRespStr = "" > > > webReq = Net.HttpWebRequest.Create(URL) > webReq.Timeout = 15000 > Try > webResp = webReq.GetResponse > Catch ex As Exception > LoopErrMsg += (deleted extra stuff here > for this email) > End Try > > webResp.Close() > > (deleted extra stuff here for this email) > > Catch ex As Exception > LoopErrMsg += (deleted extra stuff here for > this email) > End Try > > > > Kevin Yu [MSFT] wrote: >> Hi cj, >> >> Based on the code snippet you have provided, I didn't see the code >> that you're closing the underlying connection. Usually, people forget >> that the underlying connection created by the request is not freed >> up,unless you call Close() on the response. So, you hit the connection >> limit, and no more webrequests will go through. Please call >> Response.Close() to close it when it is used. >> >> You can check the following link for more information. >> >> http://blogs.msdn.com/feroze_daud/archive/2004/01/21/61400.aspx >> >> If this still doesn't help, you may be facing a performance issue for >> your ASP.NET app. Please check the following KB article for how to do >> performance tuning on this issue. >> >> http://support.microsoft.com/kb/821268/en-us >> >> Kevin Yu >> Microsoft Online Community Support >> >> ================================================== >> Get notification to my posts through email? Please refer to >> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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.) >> Hi cj,
Based on my experience, this has to be a server side issue. The web server cannot support so many concurrent requests. Although you have check that IIS doesn't have a limitation on connections, the ASP.NET has some limitations set in the configuration file. I think you have to tune the performance on the server according to the following KB article http://support.microsoft.com/kb/821268/en-us This article is for ASP.NET 1.1. However, you can also use this in ASP.NET 2.0. The 2.0 machine.config file doesn't have the default value set. You can add the keys and values manually. Kevin Yu Microsoft Online Community Support ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.)
Constants can't be defined in a namespace. WTH?
Existential question! Math class for Visual Basic.NET (matrix operations) Exception message Simple thread implementation not working. Errors in Page directive Adding a Web Reference into a Windows Project Determine if xml is malformed Date from Double when to use an Interface (the template like thing) in my project? |
|||||||||||||||||||||||