Questions tagged [wcf-faults]

15 questions
10
votes
2 answers

Unit testing WCF Faults

What's the best way to unit test expected faults from WCF services? I am attempting to unit test a WCF service which is (correctly) throwing FaultExceptions for a certain reproducible error. The unit tests get an instance of the WCF client and call…
mattv
  • 101
  • 1
  • 5
10
votes
2 answers

How to trace WCF serialization issues / exceptions

I occasionally run into the problem that an application exception is thrown during the WCF-serialization (after returning a DataContract from my OperationContract). The only (and less meaningfull) message I get…
Fabiano
  • 5,124
  • 6
  • 42
  • 69
4
votes
4 answers

WCF fault handling

Q How can I get the original exception (occurred on the server) on the client side? I am working with a self-hosted WCF service and C# 4 and trying to set up proper exception handling. I have a client that looks like this private ServiceResponse…
oleksii
  • 35,458
  • 16
  • 93
  • 163
4
votes
1 answer

Why does WCF fault the channel when using security?

Background: I've noticed that in my WCF services, when I throw an Exception (a plain old exception), the client channel enters the faulted state and has to be aborted and re-created before I can make another call on that channel. That's fine.…
Trevor
  • 4,620
  • 2
  • 28
  • 37
3
votes
1 answer

Does anybody actually use FaultReasonText to localize faults from WCF services?

There is a localization mechanism in WCF that enables one to localize faults returned to client, via a FaultReasonText object that's a part of the fault. The way this is done is that you pass all possible translations of the fault's message inside a…
urig
  • 16,016
  • 26
  • 115
  • 184
3
votes
1 answer

Unit-testing > unreachable code detected warning

Problem Compiler gives me a warning at a return line with a message: Unreachable code detected Question How can I refactor my unit test so I don't get compiler warning? Any other feedback is also welcome. Code I have a Bar class that wraps WCF…
oleksii
  • 35,458
  • 16
  • 93
  • 163
2
votes
2 answers

WCF ValidationFault

I'm using Validation Application Block - Enterprise Library to validate parameters sent to my WCF Service operations. For instance, a certain operation requires the parameter to either be a 1 or 6, like…
Ta01
  • 31,040
  • 13
  • 70
  • 99
2
votes
1 answer

Log WCF Errors on Client

My application calls a web-service using WCF. The call can fail for various reasons: fault timeout connection lost ... I want to log all such errors. Instead of wrapping every call in a try-catch, I want to do this in one place for all web-service…
usr
  • 168,620
  • 35
  • 240
  • 369
1
vote
1 answer

Why Enterprise Library does not throw FaultException in WCF

I use WCF service hosted on IIS. Also, I use fault contracts to send errors to the client (FaultException<'T>) On the client side I catch FaultException<'T> to show some error to user. If some unhandled exception being thrown on a server, WCF…
1
vote
1 answer

WCF Getting "The primary signature must be encrypted." from FaultContract with ProtectionLevel.None

I have an existing asp.net application that talks to load balanced wcf services (iis hosted, in app pool running under account configured as servicePrincipalName, etc.). The wcf services return a few custom faults, all defined with…
Donald Byrd
  • 7,668
  • 4
  • 33
  • 50
1
vote
1 answer

How to return standard message on exception/fault in WCF

In our application all data contract have one parent - OperationResponse and this OperationResponse contains enum (enum type OperationState in property Result) which represents calling result (Ok, InvalidParams, Error). How can I overwrite WCF…
Sebastian Busek
  • 952
  • 1
  • 14
  • 28
1
vote
2 answers

Managing / Modifying Deserialisation Faults / Intercepting Responses

Let's say I have the following request object: [DataContract] public class MyContract { [DataMember] public Guid Token { get; set; } } And a WCF service definition as follows: [ServiceContract] public interface IMyService { …
Spikeh
  • 3,540
  • 4
  • 24
  • 49
0
votes
0 answers

WCFFaultException with an error status code is always being returned back to the client as 202 accepted

In our application, if required, we are throwing a fault exception as follows: throw new WebFaultException(new RequestFaultInfo(errorMessage), System.Net.HttpStatusCode.BadRequest); The RequestFaultInfo class is as follows: /// ///…
Sputnik
  • 39
  • 4
0
votes
1 answer

Exception in a WCF Data service when transfering a byte[]

I'm testing a recent WCF Data Service that I've set. Most of things are working good, there is only one collection, when I add an object and save change, I got this exception: System.Data.Services.Client.DataServiceRequestException was unhandled …
J4N
  • 19,480
  • 39
  • 187
  • 340
0
votes
0 answers

service is in a fault state exception only in one environment

I am using the same DLLs of various services that I used in one of the development environment to the Test. I ensured configs are same except for endpoint address where it is the servername in each case. I dont have any problem in Dev. However, in…
Jasmine
  • 5,186
  • 16
  • 62
  • 114