本文介绍了是MVC4行动是线程安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用asp.net mvc4,但我有一个关于行动的问题,是行动是线程安全的?我的意思是,当2请求来了,这是可能的1请求处理,但没有完成,第二个请求开始办理?

,或者如果它是线程安全的,等待完成一个请求,另一个请求?

感谢。

Because I need check data on 1 method, if the data not found, I will write it on method 5. If execute not use thread safe, it will write 3 data.(because all not found data on method 1, also all not wait finish together......)

Update2:

Maybe I'm confuse about Thread safe, but Thanks friends helping.

解决方案

Of course, otherwise your website could effectively handle only one page view at a time.

You will have to make your code thread-safe. See for example how to lock an asp.net mvc action?, or you could for example create a lock in your database which your code has to query.

这篇关于是MVC4行动是线程安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 17:36