WCF - FaultException Overhead on Your Service

I posted a question about using messages against Fault exceptions to exchange business rules between services.

I got the impression that he was carrying overhead to throw this exception on the wire, but looking at this simply a message that is serialized and deserialized, they were actually the same thing.

But it made me think about throwing exceptions in general or, in particular, throwing FaultExceptions.

Now in my service if i use

throw new FaultException

Report a simple business rule, such as "Your account has not been activated," What overhead is now incurred? Is this the same overhead as regular exceptions in .NET? or the WCF service processes them more efficiently using Failure Contracts.

So, in my user example, which is the best / preferred way to write my maintenance method

option a

public void AuthenticateUser()
{
    throw new FaultException("Your account has not been activated");
}

option b

public AutheticateDto AutheticateUser()
{
     return new AutheticateDto() { 
          Success = false,
          Message = "Your account has not been activated"};
}
+3
source share
2 answers

... , -, . , . , , , , "CanOpenFile" .

, , (, - IIS), , . , .

, , , , , . - catch:)

Microsoft:

Fusion: ,

+4

, , , , .

, SOAP , , , .

0

Source: https://habr.com/ru/post/1697189/


All Articles