Should I set IsReusable to True in my HttpHandlers?

后端 未结 3 1986
故里飘歌
故里飘歌 2021-02-13 13:00

I\'ve never fully understood this property of the IHttpHandler. It is a property that you have to set when you implement the interface. I\'ve assumed that setting it to true w

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-13 13:49

    It is used to indicate if a single instance of the IHttpHandler will be used to process multiple concurrent requests. So if you set it to true it will improve performance but you must make sure that your code is thread safe because the ProcessRequest method might be invoked from multiple threads at the same time.

提交回复
热议问题