question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Propogate ExecutionContext when run in IIS

See original GitHub issue

Moving bug from the codeplex as it is still an issue for us with no easy solution.

If you develop OWIN middleware for monitoring you need to use ThreadAsync or CallContext to keep the context across the async/await. And it is working fine. However if you try to use the same middleware when hosting your application in IIS - it doesn’t propagate the context any longer.

Even better if there will be a possibility to set the context from HttModule’s Begin callback that will be preserved to the controller execution.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
maximcuscommented, Oct 25, 2018

Yes that works if the handler completes synchronously. If it’s async then it won’t flow to the controller.

@davidfowl , can you please elaborate on this. Did you mean that ExecutionContext can be lost between PreRequestHandlerExecute and the next step if Action (on a Controller) processing the request is an async method? If so then why?

0reactions
ysmoradicommented, Jun 13, 2017

Remember that things have changed too in .NET Core. my approach is working fine on .NET Core 2 too

Read more comments on GitHub >

github_iconTop Results From Across the Web

IIS Best Practices
The content folder should only need "read" and "read and execute" permissions. If your application needs to write something (like logs or temp ......
Read more >
Timers that capture the execution context, evil AsyncLocal and ...
Timers that capture the execution context, evil AsyncLocal and the quick and ugly solution used by Microsoft devs.
Read more >
ASP.NET Process.Start work background in task Manger ...
EXE file in mvc 3 application when we run this project locally on browser it work perfectly . Problem is that when we...
Read more >
Performance Impact and Troubleshooting IIS Worker ...
Open IIS management console, you can view the running worker process and select the IIS application pool in question which is causing high...
Read more >
How to Troubleshoot an ASP.NET Crash & Analyze w3wp ...
Run (ExecutionContext executionContext, ContextCallback callback, ... To identify the root cause of a w3wp crash, you are going to want a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found