I am new to WCF. Is the client connected when the service is instantiated
SampleService client = new SampleService();
Or does it connect and disconnect when a method is called on the client?
client.sampleMethod();
I want to connect to the client and send multiple messages across the same connection. Is this possible?
To answer your second question: the connection is kept open by default.
For the first, and as an clarification to above statement: it depends on the binding. For starters, there is no
Connect()method inClientBase<TChannel>(which a WCF proxy client inherits from), so there’ll be no use calling it since that’ll throw a compiler error.A connection to the service is made upon the first call to the service; the constructor does nothing more than bring the client object in a usable state, it does not connect to the service.