SoapHttpClientProtocol 线程安全吗? [英] Is SoapHttpClientProtocol thread safe?

查看:32
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆