그래서 HTTPwebrequests에 사용하는이 클래스가 있습니다. 내 프로그램의이 인스턴스에서는 쿠키뿐만 아니라 일부 데이터를 게시하고 있습니다. 이제 정말 이상한 부분을 털어 놓습니다. 필자는 헤더를 냄새 맡고 테스트 할 때 내 프로그램의 트래픽을 모니터링하기 위해 바이올린을 사용합니다. 피들러가 열려 있으면이 함수는 정상적으로 작동합니다. anydata를 게시 할 때마다 fidler가 닫히면 작업 시간이 초과됩니다. 그것은 항상 이것을합니다. 내가 무엇을 하던지. 나가 좌절에서 나의 머리를 끌어 당기는 때 누군가는 이것에 약간 빛을 비울 수 있는다.HttpWebRequest 및 응답 문제
Public Function Send(ByVal URL As String, _
Optional ByVal PostData As String = "", _
Optional ByVal Method As HTTPMethod = HTTPMethod.HTTP_GET, _
Optional ByVal ContentType As String = "", Optional ByVal Refer As String = "")
Dim Request As HttpWebRequest = WebRequest.Create(URL)
Dim Response As HttpWebResponse
System.Net.ServicePointManager.Expect100Continue = False
Dim SW As StreamWriter
Dim SR As StreamReader
Dim ResponseData As String
Dim a As New CookieContainer()
' Request.Proxy = New WebProxy("173.234.250.164", 3128)
' Prepare Request Object
Request.Method = Method.ToString().Substring(5)
Request.CookieContainer = a
' Set form/post content-type if necessary
If (Method = HTTPMethod.HTTP_POST AndAlso PostData <> "" AndAlso ContentType = "") Then
ContentType = "application/x-www-form-urlencoded"
End If
'Set User Agent
Request.UserAgent = ("Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB6.6)")
'Set Refer
If (Refer <> "") Then
Request.Referer = Refer
End If
' Set Content-Type
If (ContentType <> "") Then
Request.ContentType = ContentType
Request.ContentLength = PostData.Length
End If
'Set Cookie If Given
If (Cookie <> "") Then
Request.Headers.Add("cookie", Cookie)
End If
' Send Request, If Request
If (Method = HTTPMethod.HTTP_POST) Then
Try
Debug.Print("Inside Post")
SW = New StreamWriter(Request.GetRequestStream())
SW.Write(PostData)
Debug.Print("Wrote Post Data")
Catch Ex As Exception
Throw Ex
Finally
SW.Close()
End Try
End If
' Receive Response
Try
Response = Request.GetResponse()
For Each cook As Cookie In Response.Cookies
Cookie = Cookie & cook.ToString() & ";"
Next
Debug.Print(Cookie)
SR = New StreamReader(Response.GetResponseStream())
ResponseData = SR.ReadToEnd()
Catch Wex As System.Net.WebException
SR = New StreamReader(Wex.Response.GetResponseStream())
ResponseData = SR.ReadToEnd()
Throw New Exception(ResponseData)
Finally
SR.Close()
End Try
Return ResponseData
End Function
WCF에서 비슷한 문제가 발생했습니다. http://stackoverflow.com/questions/1646985/wcf-client-hang-on-service-interruption/1659667#1659667. 너처럼 보이는데. 프로그래밍 방식으로 동일한 설정을 적용하므로 솔루션처럼 보이지 않습니다. – roufamatic