Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I have multiple Linux servers so we created common DNS for load balancing

if I call any individual server then we got response quickly but if I call common DNS then it request get hang on below line
Using reqStream As Stream = req.GetRequestStream()

below I mention my function to which is working fine with individual server
Dim resp As System.Net.WebResponse = Nothing
Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(address)
Dim byteData() As Byte
            CType(req, HttpWebRequest).KeepAlive = False
            CType(req, HttpWebRequest).Headers.Add("HTTP_ACCEPT_ENCODING", "gzip,deflate,sdch")

            req.Method = "POST"
            req.Timeout = 60000
            req.ContentType = "application/json"

            byteData = Encoding.UTF8.GetBytes(strRequestJSON)
            req.ContentLength = byteData.Length

            Using reqStream As Stream = req.GetRequestStream()
                reqStream.Write(byteData, 0, byteData.Length)
                reqStream.Close()
            End Using

            Dim myHttpWebResponse As HttpWebResponse = CType(req.GetResponse(), HttpWebResponse)

            Return New System.IO.StreamReader(myHttpWebResponse.GetResponseStream(), System.Text.Encoding.UTF8).ReadToEnd()

Please help or suggest if you face same issue with ROUND-ROBIN DNS
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900