"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.Http Exception 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.Redire ct. 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.EventArg s) Handles MyBase.Load
Dim bh As New BeginEventHandl er(AddressOf Me.BeginPage)
Dim eh As New EndEventHandler (AddressOf Me.EndPage)
Me.AddOnPreRend erCompleteAsync (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("Be ginPage: Thread #" &
System.Threadin g.Thread.Curren tThread.GetHash Code() & "; " &
System.Threadin g.Thread.Curren tThread.IsThrea dPoolThread)
Dim v As New vmstate
v.m_page = Me
v.m_config = m_config
Dim vrs As New viewmanagerstat e(Context, cb, v)
m_vm = New viewmanager(vrs )
Dim ts As New ThreadStart(Add ressOf m_vm.start)
Dim thread As New Thread(ts)
thread.Start()
Return vrs
End Function
Sub EndPage(ByVal ar As IAsyncResult)
Try
Trace.Write("En dPage: Thread #" &
System.Threadin g.Thread.Curren tThread.GetHash Code() & "; " &
System.Threadin g.Thread.Curren tThread.IsThrea dPoolThread)
Dim m_vrs As viewmanagerstat e = CType(ar, viewmanagerstat e)
If Not IsNothing(m_vrs .m_data.m_redir ect) Then
m_redirect = m_vrs.m_data.m_ redirect
'Response.Redir ect(m_vrs.m_dat a.m_redirect, True)
End If
Catch ex As Exception
End Try
End Sub
Protected Overrides Sub OnPreRenderComp lete(ByVal e As System.EventArg s)
MyBase.OnPreRen derComplete(e)
Try
Trace.Write("On PreRenderComple te: Thread #" &
System.Threadin g.Thread.Curren tThread.GetHash Code() & "; " &
System.Threadin g.Thread.Curren tThread.IsThrea dPoolThread)
If Not IsNothing(m_red irect) Then
Response.Redire ct(m_redirect, True)
End If
Catch ex As Exception
End Try
End Sub
For now, I left out the details of viewmanagerstat e, 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.Redire ct from EndPage. This will be
in my new thread’s context and perhaps that’s the problem right there, the
Response.Redire ct with TRUE will abort the thread (I think). After posting,
I moved the Redirect to OnPreRenderComp lete, 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.Redire ct in EndPage will not work and moving it to
OnPreRenderComp lete is the way to go.
I can provide more details of my implementation if it would help.