What does System.ServiceModel.Clientbase.Open() do? I've never used it but just came across it in some code. Can it throw exceptions? If Close() is not called is it a problem?
If you create a proxy for a WCF service the proxy is effectively ClientBase
Example from my app:
public class DataClient : ClientBase<Classes.IDataService>, Classes.IDataService
{
public DataClient(string connectToHost)
: base(new NetTcpBinding(SecurityMode.Transport)
{
PortSharingEnabled = true,
Security = new NetTcpSecurity()
{
Transport = new TcpTransportSecurity()
{
ClientCredentialType = TcpClientCredentialType.Windows
}
}
},
new EndpointAddress(string.Format("net.tcp://{0}:5555/MyService",connectToHost)))
{ }
#region IDataService Members
public Classes.Folder GetFolder(string entryID)
{
return Channel.GetFolder(entryID);
}
public Classes.IItem GetItem(string entryID)
{
return Channel.GetItem(entryID);
}
#endregion
}
EDIT Per your request I googled a bit and found this:
Implements ICommunicationObject.Open()
This led to this:
CommunicationException
The ICommunicationObject was unable to be opened and has entered the Faulted state.
TimeoutException
The default open timeout elapsed before the ICommunicationObject was able to enter the Opened state and has entered the Faulted state.
Also, per experience and what I've come across on the 'net not closing your clients can cause various forms of strangeness to occur and is thus generally considered "A Bad Thing".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With