I call the WCF service, which, under certain conditions, throws an AggregateException with all the problems that occurred with the call
On the other hand, I get a FaultException (this makes sense because WCF only understands these exceptions). The problem is that the part for the contract is not a cumulative exception. As if by default, WCF gets the first exception for the AggregateException (InnerExceptions) exception list and encapsulates it. So on the client side, I just get the first exception from the list. After learning the bits, I did the following:
Added this to the contract.
[FaultContract(typeof(AggregateException))]
Then to call the service ..
try { BaseService.Blabla.Delete(item); } catch (AggregateException ex) { throw new FaultException<AggregateException>(ex); }
But on the other hand, this is:
catch (FaultException<AggregateException> ex) { string msg = string.Empty; foreach (var innerException in ex.Detail.InnerExceptions) { msg += innerException + Environment.NewLine; } MessageBox.Show(msg); } catch (Exception ex) { throw ex; }
Instead, it gets into the Exception statement and receives such an error (which, obviously, is some random error, because I have no connection problems, and debugging returns immediately, 4 minutes never pass):
The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:03:59.9939994'. : An existing connection was forcibly closed by the remote host
What am I missing?