Questions tagged [faultexception]

A FaultException is the type of exception WCF services and clients use to communicate exceptions and optionally their details.

A FaultException is the type of exception WCF services and clients use to communicate exceptions and optionally their details. Quoting from the relevant MSDN documentation page:

In a service, use the FaultException class to create an untyped fault to return to the client for debugging purposes.

In a client, catch FaultException objects to handle unknown or generic faults, such as those returned by a service with the IncludeExceptionDetailInFaults property set to true. Because FaultException extends CommunicationException, remember to catch any FaultException objects prior to catching CommunicationException objects if you want to catch them separately.

125 questions
3
votes
2 answers

Throwing exception from WCF Service without faulting

When throwing a FaultException from a WCF service, is there a way it can be thrown without faulting the actual connection? I'm looking to prevent an action for a particular method, but don't want to disrupt the client's connection (just return…
Stealth Rabbi
  • 10,156
  • 22
  • 100
  • 176
2
votes
1 answer

Accessing the ServiceModel.FaultException Detail's in a WCF Service

How do you catch/access the info within the soapenv:Detail node when a WCF service call returns an error?? Catching the FaultException alone does not include it bu I can see the data in the service trace log. Solution/Workaround: Catch ex As…
baileyswalk
  • 1,198
  • 2
  • 17
  • 29
2
votes
1 answer

WCF - A web service running in IIS but through a factory doesn't keep up the original exception thrown

A web service running in IIS but through a factory doesn't keep up the original exception thrown. For example: My web service has been marked up with FaultContractAttribute like this way: public interface IMyService { …
Undefined Identity
  • 475
  • 3
  • 7
  • 16
2
votes
1 answer

throwing faultcode("Receiver") but responding with "Server"

I'm throwing a FaultCode of Receiver, but the client is getting back "s:Server" as a response faultcode. How can i get a response of "s:Receiver"? My code: throw new FaultException(new System.ApplicationException("My…
capdragon
  • 14,565
  • 24
  • 107
  • 153
2
votes
1 answer

WCF - calling a void service (is it still synchronous)?

Basically, if my service is: public void DoSomethingThatTakesAwhile() { ... }, will the call to that service cause my application to wait for the method to finish? I ask because I don't want my caller to be able to continue until that method…
michael
  • 14,844
  • 28
  • 89
  • 177
2
votes
2 answers

Visual Studio Debugger: Skip over FaultExceptions being thrown

I have my client calling a WCF Server I'm hosting locally, right now I'm debugging the client so on the server I'm purposely throwing a FaultException to see how the client would handle it. The part that is annoying is that the debugger pauses on…
michael
  • 14,844
  • 28
  • 89
  • 177
2
votes
1 answer

Wcf and ExceptionDetail Issue

I have created my own class like this: [DataContract] public class MyOperationFault : ExceptionDetail { /// /// Contructor /// /// public MyOperationFault(Exception ex) :…
dexter
  • 7,063
  • 9
  • 54
  • 71
2
votes
1 answer

How to catch FaultExceptions from asynchronous WCF calls?

I would like to call a wcf service that can throw FaultException, but I would like to do that asynchronously. If everything's ok, it returns no exception, but if the service throws one of my FaultExceptions, in the client I get a…
Tenshiko
  • 1,450
  • 3
  • 17
  • 33
2
votes
0 answers

customize FaultException error

I created a wcf service and I'm using FaultException to throw errors to the client, however in client when I call the operation and there is an error in the server I get this kind of error message: Error message snapshot I only want the highlighted…
Ramin Ahmadi
  • 65
  • 1
  • 8
2
votes
1 answer

Serialize a FaultException of Generic Type

We currently have a mechanism of calling our web services in a test page. However, I am trying to look at the better practices of WCF services and using the FaultException. So there are cases when the FaultException is thrown by our service, I…
Andez
  • 5,588
  • 20
  • 75
  • 116
2
votes
1 answer

Xamarin Android - WCF Fault Exception Cannot Deserialize FaultDetail

Our application has always thrown FaultException with a generic type argument. In Silverilght, WCF, and UWP, the FaultException can be deserialized on the client side and the client gets a meaningful error message with a FaultDetail on the other…
Christian Findlay
  • 6,770
  • 5
  • 51
  • 103
2
votes
1 answer

Throwing WCF Fault Exception from RealProxy of Service Contract

I have a C# application with a WCF backend and a UWP frontend. I have a service implementing my service contract. Everything works as expected if I catch exceptions on the services and re-throw them as Fault Exceptions. Now I'm trying to clean up…
Connell.O'Donnell
  • 3,603
  • 11
  • 27
  • 61
2
votes
2 answers

How to invalidate a C# WCF session if login is incorrect

I am writing a remote service for an application using WCF, in which login information is kept in a database. The service requires session establishment through a login or account creation call. There is no ASP involved. Now, when a client starts a…
Elideb
  • 11,660
  • 1
  • 16
  • 16
2
votes
1 answer

Wcf exception handling throw an error

Hi I have a problem handling exceptions in wcf. I have a service like this one: [ServiceContract] public interface IAddressService { [OperationContract] [FaultContract(typeof(ExecuteCommandException))] int SavePerson(string idApp, int…
Luka
  • 4,075
  • 3
  • 35
  • 61
2
votes
1 answer

WebFaultException to pass back an XML message rather than string?

In my RESTful services layer, any exceptions that bubble up to me are caught as Fault Exceptions. Within that FaultException, there's a custom XML message that contains , and a . I re-package the exception as a…
Shafique
  • 1,828
  • 6
  • 26
  • 36
1 2
3
8 9