"Steven Cheng[MSFT]" wrote:
Hello Pb,
Based on your description, you have an ASP.NET page that is configured as
async execution and it works for most time but will occasionally raise some
error as below, correct?
>>>>>>>>>>>>>>>>>>
System.Web.HttpException was caught
ErrorCode=-2147024809
Message="An error occurred while communicating with the remote host. The
error code is 0x80070057."
<<<<<<<<<<<<<<<<<<<
So far as I've researched, there hasn't any definite issue of the ASP.NET
2.0 Async page execution. I think the problem here should be application
code logic specific. Would you provide some code logic of your problem
async page, such as what you've done in the async handler, and when you
call the response.Redirect. If possible, you can try simplified it to the
code that is necessary to repro the problem.
In addition, have you checked whether the problem occurs at high stress
condition, such as the application has been stressed under high volume
request execution or will occur even if there is few concurrent requests?
Anyway, please feel free to let me know if you have any other finding or
anything I've missed on this
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
I may have solved my problem, but it’s hard to know with intermittent
problems like this… so let me better describe it:
The async model is hooked up like this:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim bh As New BeginEventHandler(AddressOf Me.BeginPage)
Dim eh As New EndEventHandler(AddressOf Me.EndPage)
Me.AddOnPreRenderCompleteAsync(bh, eh)
End Sub
Function BeginPage(ByVal src As Object, ByVal args As EventArgs, ByVal cb As
AsyncCallback, ByVal state As Object) As IAsyncResult
Trace.Write("BeginPage: Thread #" &
System.Threading.Thread.CurrentThread.GetHashCode( ) & "; " &
System.Threading.Thread.CurrentThread.IsThreadPool Thread)
Dim v As New vmstate
v.m_page = Me
v.m_config = m_config
Dim vrs As New viewmanagerstate(Context, cb, v)
m_vm = New viewmanager(vrs)
Dim ts As New ThreadStart(AddressOf m_vm.start)
Dim thread As New Thread(ts)
thread.Start()
Return vrs
End Function
Sub EndPage(ByVal ar As IAsyncResult)
Try
Trace.Write("EndPage: Thread #" &
System.Threading.Thread.CurrentThread.GetHashCode( ) & "; " &
System.Threading.Thread.CurrentThread.IsThreadPool Thread)
Dim m_vrs As viewmanagerstate = CType(ar, viewmanagerstate)
If Not IsNothing(m_vrs.m_data.m_redirect) Then
m_redirect = m_vrs.m_data.m_redirect
'Response.Redirect(m_vrs.m_data.m_redirect, True)
End If
Catch ex As Exception
End Try
End Sub
Protected Overrides Sub OnPreRenderComplete(ByVal e As System.EventArgs)
MyBase.OnPreRenderComplete(e)
Try
Trace.Write("OnPreRenderComplete: Thread #" &
System.Threading.Thread.CurrentThread.GetHashCode( ) & "; " &
System.Threading.Thread.CurrentThread.IsThreadPool Thread)
If Not IsNothing(m_redirect) Then
Response.Redirect(m_redirect, True)
End If
Catch ex As Exception
End Try
End Sub
For now, I left out the details of viewmanagerstate, but it is a class that
implements IAsyncResult.
So in begin, I spin off a new thread. This is NOT a thread pool thread
(which of course is the whole point).
So the trouble occurs if I use Response.Redirect from EndPage. This will be
in my new thread’s context and perhaps that’s the problem right there, the
Response.Redirect with TRUE will abort the thread (I think). After posting,
I moved the Redirect to OnPreRenderComplete, where we are back on a thread
pool thread.
It seems to work there; I have tested it and can’t get it to break as
before, but I am concerned that the problem is just less likely in this
context vs. fixed. It would be great to confirm from MSFT that the
Response.Redirect in EndPage will not work and moving it to
OnPreRenderComplete is the way to go.
I can provide more details of my implementation if it would help.