How avoid 'Operation Time Out' when using multiple concurrent Http Request.Get requests.

Lana Pieczynski 1 Reputation point
2021-11-27T00:11:40.743+00:00

I am sending out about 200 SMS messages in my asp.net app (going through the 3rd party vendor, Clickatell). I am sending out about 10 at a time and it all goes very smoothly until I have sent about 50 messages out. Then the page ultimately times out "The operation has timed out"

153022-timeouterror.jpg

At that point, I have to wait about 5 minutes and then can begin sending the messages out again but now I have sent out about 190 total and I am still getting the "Operation timed out" error and it has been over an hour. I can't seem to get my asp.net site to reset. And don't know how to avoid this bottleneck of the SMS messages going out. I feel like 200 is a relatively low number and should not be bogging down the application this much.

Here is the code I am using to send out the text messages:

Protected Sub Button24_Click(sender As Object, e As EventArgs) Handles Button24.Click
MaintainScrollPositionOnPostBack = True
For Each row As GridViewRow In GridView1.Rows
If row.RowType = DataControlRowType.DataRow Then
Dim chkRow As CheckBox = TryCast(row.Cells(0).FindControl("chkRow"), CheckBox)
If chkRow.Checked Then
Dim phone As String = row.Cells(6).Text
Dim item As String = row.Cells(2).Text
Dim URL As String = "https://platform.clickatell.com/messages/http/send?apiKey=rAJiKXHPQE2rzrEW3WBTtw==&from=13397070155&to=1" + phone
URL=URL + "&content=This is a test!"
Dim myproxy As WebProxy = New WebProxy("http://ntproxyus.lxa.perfora.net:3128", False)
Dim request As WebRequest = WebRequest.Create(URL)
request.Proxy = myproxy
request.Method = "GET"
request.timeout = 5000
Dim response As HttpWebResponse = request.GetResponse()
End If
End If
Next
Me.LabeltxtConf.Visible = True
Me.LabelConf.Visible = False
For Each row2 As GridViewRow In GridView1.Rows
If row2.RowType = DataControlRowType.DataRow Then
Dim chkRow2 As CheckBox = TryCast(row2.Cells(0).FindControl("chkRow"), CheckBox)
chkRow2.Checked = False
End If
Next
End Sub

Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yijing Sun-MSFT 7,106 Reputation points
    2021-11-27T01:59:07.523+00:00

    Hi @Lana Pieczynski ,
    As far as I think,according to your description,you could close/dispose your WebResponse object.
    Best regards,
    Yijing Sun


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.