我总是抽出时间使用这段代码。
帖子是https并且运行正常,但从未得到回复,
我尝试使用HttpWebRequest和WebRequest,超时但没有响应
你可以帮帮我吗?>System.Net.ServicePointManager.CertificatePolicy = New TrustAllCertificatePolicy()
>
>req = HttpWebRequest.Create(URL)
>req.Method = "POST"
>req.Timeout = 60000
>
>Dim byteArray = Encoding.UTF8.GetBytes(URL)
>
>req.ContentType = "text/xml"
>
>req.ContentLength = byteArray.Length
>
>Dim dataStream As Stream
>dataStream = req.GetRequestStream()
>
>dataStream.Write(byteArray, 0, byteArray.Length)
>
>dataStream.Close()
>dataStream.Dispose()
>
>Dim response As HttpWebResponse = Nothing
>
><b>response = req.GetResponse() '---->>> always timeout here </b>
>
>dataStream = response.GetResponseStream()
>
>Dim reader As StreamReader
>reader = New StreamReader(dataStream)
>
>Dim responseFromServer As String
>responseFromServer = reader.ReadToEnd()
>reader.Close()
>dataStream.Close()
>dataStream.Dispose()
>response.Close()