how to lock an asp.net mvc action?

后端 未结 6 672
情话喂你
情话喂你 2020-12-01 05:46

I\'ve written a controller and action that I use as a service. This service runs quite a costly action. I\'d like to limit the access to this action if there is already a cu

6条回答
  •  难免孤独
    2020-12-01 06:17

    i have suggestions about that.

    1- https://github.com/madelson/DistributedLock system wide lock solution

    2- Hangfire BackgroundJob.Enqueue with [DisableConcurrentExecution(1000)] attribute.

    Two solution are pending for process to be finished. i don't want to throw error when request same time.

提交回复
热议问题