Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 2
    Will not work for multithreading. Commented Apr 23 at 8:40
  • And accessing any sort of shared state from a static context will kill you application's ability to serve multiple requests by the same user concurrently if you have IIS configured for sticky sessions. Commented Apr 23 at 10:57
  • I was worried about this. But what other option do I have? Commented Apr 23 at 12:05
  • Can you use OWIN -- is your application old enough to use that? I think the trick here is to initialize the service locator as an object at the beginning of your pipeline. Then each middleware component can pull it out of the current HTTP context. Commented Apr 23 at 12:22
  • No, it's dotnet 9. Commented Apr 23 at 21:58