I just discovered why all ASP.Net websites are slow, and I am trying to work out what to do about it

前端 未结 10 658
情话喂你
情话喂你 2020-11-22 07:53

I just discovered that every request in an ASP.Net web application gets a Session lock at the beginning of a request, and then releases it at the end of the request!

10条回答
  •  粉色の甜心
    2020-11-22 08:37

    Marking a controller's session state as readonly or disabled will solve the problem.

    You can decorate a controller with the following attribute to mark it read-only:

    [SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)]
    

    the System.Web.SessionState.SessionStateBehavior enum has the following values:

    • Default
    • Disabled
    • ReadOnly
    • Required

提交回复
热议问题