I use WCF netNamedPipeBinding
and wsHttpBinding
. I would like to know whether a one-way method can execute successfully without try
ing it.
EDIT As someone noted the conectivity can succeed a given moment and in the next fail. I don't care. I just want to know if WCF has an alternative to try
ing. Is there any way to check if the service is up and reachable?
To my knoweldge the only way to determine if a one-way method executed successfully is whether or not it generates an exception.
If the method does not HAVE to be a one-way method you can return back a boolean value that states whether or not the method failed or succeeded.
Might I ask as to why you are trying to do this? Without catching an exception on the method there is no way to tell of error conditions if an exception does occur.
If I'm misunderstanding your use of "try ing" it and you mean without actually executing the method, you can write a proxy for the method that doesn't actually commit the action, only does the processing step.
If you are doing this for entirely testing purposes I would like to recommend taking advantage of the Visual Studio unit tests or wiring your project into NUnit.
Please provide more details of what you are trying to accomplish if one of the points above didn't answer your question.
EDIT: Modified to account for clarification by asker.
Will cover you to see if the connection is currently open AND will notify you if/when the service goes into a faulted state. This will preemptively let you know whether or not the call will succeed. However, there are still conditions that may cause that specific method to fail.. This will only notify you if you can successfully call the service method.