Session containing items implementing IDisposable

后端 未结 3 1551
北海茫月
北海茫月 2020-12-17 00:18

In ASP.NET if items are left in the session state that Implement IDisposable but are never specifically removed and disposed by the application when the session expires will

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 01:10

    I'd be concerned to have Disposable objects in Session. It will almost certainly create a scalability issue for you. Anything that is Disposable is probably connected to some limited resource, if you have many active sessions you are likely to use up that resource. Secondly I'd expect that many (most?) disposable objects will not work well in a web farm as the resource they are tied to is probably local to a single machine and they won't serialize and then deserialize on another machine in the same state.

提交回复
热议问题