Significance of bool IsReusable in http handler interface

后端 未结 3 1628
[愿得一人]
[愿得一人] 2021-01-30 02:15

When writing a http handler/module, there is an interface member to implement called - bool IsReusable.

What is the significance of this member? If I set it to false (or

3条回答
  •  清歌不尽
    2021-01-30 02:28

    Further to AnthonyWJones's answer, if your HTTP handler returns true for IsReusable then you should ensure that it is fully thread-safe.

    There's nothing in the documentation to indicate that reusable handlers can't be reused concurrently, although the current Microsoft implementations only appear to reuse them consecutively. But, at least in theory, a single handler instance could be reused simultaneously by multiple requests, so you shouldn't rely on any data which might be modified by other concurrent threads.

提交回复
热议问题