English 中文(简体)
如何组织协会。 NET要求锁定或锁定在非行的锁定
原标题:How to organize ASP.NET request locking or row locking in DB
  • 时间:2009-11-06 09:54:04
  •  标签:

I ve asp.net page/handler to access images. When performed fist request to the image I resize image to standard size(save on disk) and return it. So I need lock all request to the image except one. This one will resize image. Image identified by ID in URL, so I guess one lock object required per one image(ID in URL). My question is How can I organize this lock model?

My idea add lock object in Application (Application is synchronized) like this Application.Add(Request[Id], new object()); and use it to locking competitive threads.

这项任务,如锁定非行,或在收集过程中锁定内容。

感谢您的回馈。

最佳回答

最容易的方式是把图像档案锁定在册。


using (FileStream fs = new FileStream("image.file", FileMode.Create, FileAccess.Write, FileShare.None))
{

resize image here 

}

第二(第三等)试图制造例外,“这一过程不能查阅档案......”就会消失。 我在法典中处理这一例外。

问题回答

暂无回答




相关问题
热门标签