WCF Faulted state exception- cannot be used for communication because it is in the Faulted state.

1924
Views
1
Answers

Hi, I am using WCF testclient to test my WCF service. I get this error

The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.

what would be the possible cause for this error?

edit | flag
William Patrick
Asked on: Dec 02, 2011 at 9:21PM

1 Answers

78
4
78

The possible causes may be
1.You need to handle the exception properly

try
{
   
...
   
double result = client.Add(value1, value2);
   
...
    client
.Close();
}
catch (TimeoutException exception)
{
   
Console.WriteLine("Got {0}", exception.GetType());
    client
.Abort();
}
catch (CommunicationException exception)
{
   
Console.WriteLine("Got {0}", exception.GetType());
    client
.Abort();
}

2.You should avoid putting client proxies in 'using' blocks, see

3.Make sure to close all database calls.

Good Luck!!

edit | flag
Gokul A
Answered on: Dec 02, 2011 at 9:25PM

Post your Answer

Search

Welcome to Ask Amoeba!
This is 100% free and interactive site for sharing professional Questions and Answers, Opensource projects, Interview questions.
Learners, beginners, Experts stop and share your knowledge and ideas!

Browse Categories

Browse Tags