J
J
John_Nash2017-03-22 14:48:11
C++ / C#
John_Nash, 2017-03-22 14:48:11

ServiceModel.ClientBase needs to check the connection. Is there a way?

ServiceModel.ClientBase<TChannel>you need to check the connection.
Checked so: State != CommunicationState.Opened
But at first there is an exception, and only then the State changes.
There is an option to make an empty method on the server and always pull it, but maybe there is some kind of built-in solution?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Pavlov, 2017-04-13
@dmitry_pavlov

Maybe the problem is that you need to check the state as a bit mask (like flags) or check for a different status?

if ((_service.State & CommunicationState.Faulted) == CommunicationState.Faulted)
{
    // ...
}

Or track the exception through an event and clean up the fallen service instance by reconnecting. Suggestive links .
PS This is just a guess.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question