WCF catching EndPointNotFoundException
-
I am trying to connect a client to server using WCF. The following code works when the server code is loaded (named pipe, same machine). m_app is initialized as follows: const string address = @"net.pipe://localhost/Pipe"; EndpointAddress ep = new EndpointAddress(address); m_app = ChannelFactory.CreateChannel(new NetNamedPipeBinding(), ep); I am trying to catch the exception EndPointNotFoundException. The catch block below initially used EndPointNotFoundException but didn't work so I tried CommunicationException. I want to catch the situation where the server is not present. What am I missing? try { LoginResult result = m_app.DoLogin(username, password); return result; } catch (CommunicationException e) { }
-
I am trying to connect a client to server using WCF. The following code works when the server code is loaded (named pipe, same machine). m_app is initialized as follows: const string address = @"net.pipe://localhost/Pipe"; EndpointAddress ep = new EndpointAddress(address); m_app = ChannelFactory.CreateChannel(new NetNamedPipeBinding(), ep); I am trying to catch the exception EndPointNotFoundException. The catch block below initially used EndPointNotFoundException but didn't work so I tried CommunicationException. I want to catch the situation where the server is not present. What am I missing? try { LoginResult result = m_app.DoLogin(username, password); return result; } catch (CommunicationException e) { }
Perhaps you could just catch
Exception
, inspect the derived type, then recode to catch that exception? (I'm surprisedCommunicationException
didn't work). /raviMy new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com