I am trying to pass an exception from a WCF module to a client module. I get the following error: "FaultException was unhandled by the user"
on the part of the service
public IList<UserEntity> SearchUserDetail(string userName) { try { int y = 0; int u = 9 / y; return new UserViewModel().SearchUserDetail(userName); } catch (Exception ex) { throw new FaultException( new FaultReason(ex.Message),new FaultCode("Data Access Error")); } }
on the client side
try { ServiceReference.ServiceClient servRef = new ServiceReference.ServiceClient(); List<UserEntity> users = new List<UserEntity>(); users.AddRange(servRef.SearchUserDetail("Jacson")); dataGridView1.DataSource = users; } catch (System.ServiceModel.FaultException exc) { Logging.Log(new Exception("Search User", exc)); }
In the app.config of the service module, I added the following attribute
serviceDebug includeExceptionDetailInFaults="True"
Does anyone know a solution?
source share