作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个基于 SoapHttpClientProtocol 的 Web 服务引用 (.NET CF 3.5)。我的问题是——除了调用 web 方法之外,有没有办法确定是否建立了与 WebService 的连接?我可以随时检查底层连接是否已建立并获取其状态吗?
问候
最佳答案
您可以在客户端查看通信状态。
using (XServiceSoapClient client = new XServiceSoapClient())
{
client.State;
}
public enum CommunicationState
{
// Summary:
// Indicates that the communication object has been instantiated and is configurable,
// but not yet open or ready for use.
Created = 0,
//
// Summary:
// Indicates that the communication object is being transitioned from the System.ServiceModel.CommunicationState.Created
// state to the System.ServiceModel.CommunicationState.Opened state.
Opening = 1,
//
// Summary:
// Indicates that the communication object is now open and ready to be used.
Opened = 2,
//
// Summary:
// Indicates that the communication object is transitioning to the System.ServiceModel.CommunicationState.Closed
// state.
Closing = 3,
//
// Summary:
// Indicates that the communication object has been closed and is no longer
// usable.
Closed = 4,
//
// Summary:
// Indicates that the communication object has encountered an error or fault
// from which it cannot recover and from which it is no longer usable.
Faulted = 5,
}
关于c# - SoapHttpClientProtocol/HttpWebClientProtocol 连接状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3997711/
我有一个基于 SoapHttpClientProtocol 的 Web 服务引用 (.NET CF 3.5)。我的问题是——除了调用 web 方法之外,有没有办法确定是否建立了与 WebService
我是一名优秀的程序员,十分优秀!