J
Jim Butler
I have this error that is happening on all of our web servers (production
included). It basically started occurring once we loaded 2005 sql client
tools, asp.net 2.0 (and all related prerequistes) on our windows 2003 web
servers (unfortunately they are needed, so uninstalling is not an option).
The web app where this happens, runs both asp code and .net 1.1 code within
the same web app. In the asp app, we scrape and post data to .net 1.1 pages
in the middle of asp pages. This is accomplished through a com visible .net
class (in GAC too, code below). The errors didn't start happening till we
installed the above software and now the entire app is unstable and the
errors are sproadic. Typically, once the error has happened, the entire app
must be recycled. The web app is running in local system, and it isolated
by itself (no other web apps share the pool) In iis, the app is set to run
under the 1.1 framework. My recent hopeful fix was to set keep-alives to
false and switch the protocol to v10 (based on other research), which didn't
really help. The error presents itself equally across post's and get's.
Any ideas, it is creating a huge problem for us,
TIA
jim butler
Option Explicit On
Option Strict On
Imports System.Net
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Runtime.InteropServices
Imports System.Web
Public Class HttpAutomation
Public Sub New()
' do nothing, needed for com
End Sub
<ComVisible(True)> Public Function GetPage(ByVal url As String) As
String
Dim result As String
Dim objResponse As HttpWebResponse
Dim objRequest As HttpWebRequest =
CType(System.Net.HttpWebRequest.Create(url), HttpWebRequest)
objRequest.KeepAlive = False
objRequest.ProtocolVersion = HttpVersion.Version10
objRequest.Accept = "*/*"
objRequest.UserAgent = "User-Agent, Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705"
objResponse = CType(objRequest.GetResponse(), HttpWebResponse)
Dim sr As New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
objResponse.Close()
Return result
End Function
<ComVisible(True)> Public Function PostPage(ByVal url As String, ByVal
formVariables As String) As String
Dim result As String
Dim myWriter As StreamWriter = Nothing
Dim objResponse As HttpWebResponse
Dim objRequest As HttpWebRequest =
CType(System.Net.HttpWebRequest.Create(url), HttpWebRequest)
objRequest.Method = "POST"
objRequest.ContentLength = formVariables.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
objRequest.KeepAlive = False
objRequest.ProtocolVersion = HttpVersion.Version10
objRequest.Accept = "*/*"
objRequest.UserAgent = "User-Agent, Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705"
Try
myWriter = New StreamWriter(objRequest.GetRequestStream())
myWriter.Write(formVariables)
Catch e As Exception
Throw New Exception("Error in HTTPAutomation: URL: " & url & "
:FormVariables: " & formVariables)
Finally
myWriter.Close()
End Try
objResponse = CType(objRequest.GetResponse(), HttpWebResponse)
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
sr.Close()
Return result
End Function
End Class
included). It basically started occurring once we loaded 2005 sql client
tools, asp.net 2.0 (and all related prerequistes) on our windows 2003 web
servers (unfortunately they are needed, so uninstalling is not an option).
The web app where this happens, runs both asp code and .net 1.1 code within
the same web app. In the asp app, we scrape and post data to .net 1.1 pages
in the middle of asp pages. This is accomplished through a com visible .net
class (in GAC too, code below). The errors didn't start happening till we
installed the above software and now the entire app is unstable and the
errors are sproadic. Typically, once the error has happened, the entire app
must be recycled. The web app is running in local system, and it isolated
by itself (no other web apps share the pool) In iis, the app is set to run
under the 1.1 framework. My recent hopeful fix was to set keep-alives to
false and switch the protocol to v10 (based on other research), which didn't
really help. The error presents itself equally across post's and get's.
Any ideas, it is creating a huge problem for us,
TIA
jim butler
Option Explicit On
Option Strict On
Imports System.Net
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Runtime.InteropServices
Imports System.Web
Public Class HttpAutomation
Public Sub New()
' do nothing, needed for com
End Sub
<ComVisible(True)> Public Function GetPage(ByVal url As String) As
String
Dim result As String
Dim objResponse As HttpWebResponse
Dim objRequest As HttpWebRequest =
CType(System.Net.HttpWebRequest.Create(url), HttpWebRequest)
objRequest.KeepAlive = False
objRequest.ProtocolVersion = HttpVersion.Version10
objRequest.Accept = "*/*"
objRequest.UserAgent = "User-Agent, Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705"
objResponse = CType(objRequest.GetResponse(), HttpWebResponse)
Dim sr As New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
' Close and clean up the StreamReader
sr.Close()
objResponse.Close()
Return result
End Function
<ComVisible(True)> Public Function PostPage(ByVal url As String, ByVal
formVariables As String) As String
Dim result As String
Dim myWriter As StreamWriter = Nothing
Dim objResponse As HttpWebResponse
Dim objRequest As HttpWebRequest =
CType(System.Net.HttpWebRequest.Create(url), HttpWebRequest)
objRequest.Method = "POST"
objRequest.ContentLength = formVariables.Length
objRequest.ContentType = "application/x-www-form-urlencoded"
objRequest.KeepAlive = False
objRequest.ProtocolVersion = HttpVersion.Version10
objRequest.Accept = "*/*"
objRequest.UserAgent = "User-Agent, Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705"
Try
myWriter = New StreamWriter(objRequest.GetRequestStream())
myWriter.Write(formVariables)
Catch e As Exception
Throw New Exception("Error in HTTPAutomation: URL: " & url & "
:FormVariables: " & formVariables)
Finally
myWriter.Close()
End Try
objResponse = CType(objRequest.GetResponse(), HttpWebResponse)
Dim sr As StreamReader
sr = New StreamReader(objResponse.GetResponseStream())
result = sr.ReadToEnd()
sr.Close()
Return result
End Function
End Class