是SoapHttpClientProtocol线程安全的? [英] Is SoapHttpClientProtocol thread safe?
本文介绍了是SoapHttpClientProtocol线程安全的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了VS 2008(C#)的添加Web引用功能的Web服务代理。
I created a Web Service proxy with the "add web reference" feature of VS 2008 (c#).
生成的类从派生SoapHttpClientProtocol
我可以将我代理的一个实例存储在一个单身?难道是线程安全的?是否有会阻止我这样做调用之间的状态?
Can I store only one instance of my proxy in a singleton? Is it thread safe? Is there state between calls that would prevent me from doing this?
推荐答案
没有。它不是线程安全的。客户端必须在打开状态,以使呼叫。一个简单的场景,其中一个线程执行client.Close(),而另一个试图调用方法将失败。
No. It is not thread safe. the client must be in the Open state to enable calls. A simple scenario where one thread does client.Close() while another tries to call a method will fail.
这篇关于是SoapHttpClientProtocol线程安全的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文