Skip to content

Commit

Permalink
Fix issue - aspnet#73
Browse files Browse the repository at this point in the history
  • Loading branch information
rajkumar-rangaraj committed Jun 4, 2020
1 parent 3818245 commit afe6551
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,21 @@ private void Application_EndRequest(object sender, EventArgs e)
// BeginRequest has never been called
if (!context.Items.Contains(BeginCalledFlag))
{
// Activity has never been started
ActivityHelper.CreateRootActivity(context, ParseHeaders);
// Exception happened before BeginRequest
if (context.Error != null)
{
// Activity has never been started
ActivityHelper.CreateRootActivity(context, ParseHeaders);
}
else
{
// Rewrite: In case of rewrite, a new request context is created, called the child request, and it goes through the entire IIS/ASP.NET integrated pipeline.
// The child request can be mapped to any of the handlers configured in IIS, and it's execution is no different than it would be if it was received via the HTTP stack.
// The parent request jumps ahead in the pipeline to the end request notification, and waits for the child request to complete.
// When the child request completes, the parent request executes the end request notifications and completes itself.
// Ignore creating root activity for parent request as control got transferred from rewrite module to EndRequest with no request flow.
return;
}
}

ActivityHelper.StopAspNetActivity(context.Items);
Expand Down

0 comments on commit afe6551

Please sign in to comment.