Reputation: 1012
Inside my Form_Load background_worker_DoWork
is started where I'm using wcf service call to get countAllBooksValue. At service I'm throwing Fault exception where that exception should be catched by the client, but it doesn't.
client side
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
try
{
int countAllBooks = BookAgent.CountAllBooks();
e.Result = countAllBooks;
}
catch (FaultException ex)
{
MessageBox.Show(ex.Message);
}
}
service side
public int CountAllBooks()
{
throw new FaultException("Something bad happened!");
}
Question is: Why this FaultException is not catched by the client?
Upvotes: 0
Views: 1667
Reputation: 322
Try to set IncludeExceptionDetailInFaults property:
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
Upvotes: 1