I'm trying to throw an exception from the WCF module to client modules. I am getting the following error "User forgot fault problem"
In the service side On Customer Side I have added the following attribute in the service module's app.config Any solutions know? You must add FaultContractAttribute to the method I'm not sure about the type of FaultContract, but take a look at msdn.
Public IList & lt; UserEntity & gt; SearchUserDetail (string username) {try {int y = 0; Int u = 9 / y; New UserViewModel () Return. SearchUserDetail (userName); } Hold (Exception preceding) {New fault fault (new fault region (ex.Message), New FaultCode ("Data Access Error")); }}
Try ServiceReference.ServiceClient servRef = new ServiceReference.ServiceClient (); & Lt; UserEntity & gt; User = new list & lt; UserEntity & gt; (); Users.AddRange (servRef.SearchUserDetail ("Jacson")); DataGridView1.DataSource = Users; } Hold (System.ServiceModel.FaultException exc) {logging.log (new exception ("search user", exc)); }
in the service debug included ExceptionDetailInFaults = "True"
SearchUserDetail , if it contains the Operation Contract attribute And your service is part of the contract class. [ServiceContract] Interface IMyServiceContract {[Operation Contract] [FaultContract (typeof (...)] IList & lt; UserEntity & gt; SearchUserDetail (String Username)}
Comments
Post a Comment