[英]how to let wcf service to accept only 1 client each time
I have a question about WCF service which give the client the ability to mess up with Computer files (copy/paste/delete...etc). 我有一个关于WCF服务的问题,它让客户端能够搞乱计算机文件(复制/粘贴/删除等等)。
service should accept only 1 client at a time, it shouldn't accept a client while another client is already connected, so what configuration does this job? 服务一次只能接受一个客户端,它不应该接受客户端而另一个客户端已经连接,那么这个工作有什么配置呢? I'm using NetTcpBinding. 我正在使用NetTcpBinding。
You need not to do anything as default service behavior is to execute one call at a time. 您无需执行任何操作,因为默认服务行为是一次执行一个调用。 Which means if A is invoking X method and B also want to invoke X method then B request wont be entertain till A request is finished. 这意味着如果A正在调用X方法而B也想调用X方法,那么B请求将不会被娱乐直到请求完成。
But if your are thinking that even after method execution nobody should access the methods then you have to handle this at your own by using Sessions!! 但是如果你认为即使在方法执行后没有人应该访问这些方法,那么你必须使用Sessions自己处理这个!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.