Hi All,
I have a wcf client.
What is the best way of handling connections ?
Is it to open and close every time you need to contact the service:
void doSomething(){
MyService service = new MyService();
//try
service.doThis(10);
...
service.doThat(20);
service.Close()
// catch
}
Or should I keep opened reference and abort it and reinitialize if connection error occurs:
class Myclass{
MyService service = new MyService();
...
void myFunction(){
try{
service.doThis(10);
}catch(...){
service.abort();
service = new Myservice();
// do something here, but what it a smart thing to to?
}
}
}
Regards