我愿停止一线穿透,而另一条路面仍在实施法典的范畴:
I m currently going the following: global.asax.cs
private static bool _isProcessingNewIllustrationRequest;
public static bool IsProcessingNewIllustrationRequest
{
get { return _isProcessingNewIllustrationRequest; }
set { _isProcessingNewIllustrationRequest = value; }
}
Then in MVC:
public ActionResult CreateNewApplication()
{
if (!Global.IsProcessingNewIllustrationRequest)
{
Global.IsProcessingNewIllustrationRequest = true;
// DO WORK... RUN CODE
Global.IsProcessingNewIllustrationRequest = false;
return View("Index", model);
}
else
{
// DISPLAY A MESSAGE THAT ANOTHER REQUEST IS IN PROCESS
}
}
但是,如果似乎守则是徒劳的,因为两条read(Chrome &)仍然同时执行该守则。
<>蓬贝>
private Object thisLock = new Object();
public ActionResult CreateApplication()
{
ILog log = LogManager.GetLogger(typeof(Global));
string aa = this.ControllerContext.HttpContext.Session.SessionID;
log.Info("MY THREAD: " + aa);
lock (thisLock)
{
Thread.Sleep(8000);
DO SOME STUFF
}
}
即便有这一标志,第2版(Firefox 届会)仍然在法典中,而第1场(Chrome)正在24小时执行。 我失踪了什么?