Error: Connection Was Closed On Send in ASP.Net

Last Reply 6 months ago By AnandM

Posted 6 months ago

I Want To Call A Webservice Host On Another Server TO Get Response . bUt When i Call THsi Webservice . Response Throw Exception . Connection Was Closed On Send. 

If I Change This Url THen Working . 

Please Give Me An Solution For This Task .. 

Thanks In Advance

 Public Sub MyButton_Click(ByVal Ctrl As Office.CommandBarButton, ByRef CancelDefault As Boolean)
        Dim webResponse = ""
        Dim req As HttpWebRequest
        Dim res As HttpWebResponse = Nothing
        Dim RED As StreamReader
        Dim uri As String = ""

            req = DirectCast(WebRequest.Create(uri), HttpWebRequest)
            req.KeepAlive = False
            ServicePointManager.MaxServicePoints = 4
            ServicePointManager.MaxServicePointIdleTime = 1000
            ServicePointManager.UseNagleAlgorithm = True
            ServicePointManager.Expect100Continue = True
            ServicePointManager.CheckCertificateRevocationList = True
            ServicePointManager.DefaultConnectionLimit = _

            ' Get response  
            res = DirectCast(req.GetResponse(), HttpWebResponse)

            ' Get the response stream into a reader  
            RED = New StreamReader(res.GetResponseStream())

            ' Console application output  
            If Not res Is Nothing Then res.Close()
        End Try


I agree, here is the link: