开发者

Can a client be considered as a Thread?

开发者 https://www.devze.com 2023-02-13 07:03 出处:网络
Can we consider that two clients accessing the same method of a web service at the sa开发者_运维问答me time are two threads (with all problems involved...) ?

Can we consider that two clients accessing the same method of a web service at the sa开发者_运维问答me time are two threads (with all problems involved...) ?

Is it the same thing for methods in an asp.net web application ?


As long as you don't use static or other shared objects based on static there are no multithreading issues in the code. You do however need to consider resources (ie. files).

Each request is handled by a dedicated thread which goes back into the threadpool once its done serving the request.


It depends. See my answer to Why are these asynchronous RIA Service calls executed in serial on the web server?. It's controlled by two properties of the ServiceBehaviourAttribute, InstanceContextMode and ConcurrencyMode.


In an asp.net web application, requests from multiple clients will tend to be processed in parallel, unless (for some bizarre reason) both clients are sharing the same session and both requests are for pages marked as requiring session (which is the default I believe), in which case the two requests would be serialized.


If you are talking about WCF services, the behaviour depends upon how you configure your service. For more about it, you can read this article on MSDN and ServiceBehaviorAttribute.InstanceContextMode Property

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号