Last post May 26, 2015 06:59 AM by mgebhard
May 26, 2015 05:54 AM|mike4u|LINK
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object ins, Object outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
I have 1 method :
public interface IService
List<UserDetails> GetUserDetails(string Username);
when i tried to test this method through wcftestclient i am getting above error:
if u need i can provide code as well. kindly assist
May 26, 2015 06:38 AM|mgebhard|LINK
This error means there was an exception on the server that was not handled.
1) Wrap your code in try...catch blocks
2) Be sure to dispose faulted channels
3) Do not place you proxies in a using statement.
May 26, 2015 06:45 AM|mike4u|LINK
May 26, 2015 06:59 AM|mgebhard|LINK
You should wrap the service operations in try...catch blocks and handle any exceptions. I generally return a soap fault if an error occurs in a service,
Then on the client, handle errors too. Same deal, use try...catch blocks and handle the exceptions.
Edit: you removed the code!