Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3287470
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:29:48+00:00 2026-05-17T20:29:48+00:00

We are trying to figure out a way to modify WCF service behavior to

  • 0

We are trying to figure out a way to modify WCF service behavior to catch all exceptions and instead of returning faults to the client, it will populate a custom return object with exception data and return that. So far, we haven’t had much luck. I found this example: Catching custom faults

However, it doesn’t return custom types as we would like it to. What other options are there?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:29:49+00:00Added an answer on May 17, 2026 at 8:29 pm

    If you want to have an interoperable and “by-the-standard” service, you should always return FaultException<T> SOAP faults from your service to the client.

    Since that type takes a generic <T>, you can basically put anything into that type there to report back your errors. That type needs to be decorated with a [DataContract], and its members that need to be passed back with [DataMember] attributes.

    [DataContract]
    public class MyErrorInfo
    {
        [DataMember]
        public int ErrorCode { get; set; }
    
        [DataMember]
        public string ErrorMessage { get; set; }
    }
    

    When you catch those execptions on the service side and return a FaultException<MyErrorInfo> (or whatever you’ll end up calling your error class), you also need to decorate your operations with a

    [FaultContract(typeof(MyErrorInfo))]
    [OperationContract]
    public SomeType SomeMethodCall(SomeType parameter);
    

    so that your clients will be able to catch the FaultException<MyErrorInfo> and handle it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to figure out a way to consume a WCF service I
I am trying to figure out a way for somehow fetching the all the
I am trying to figure out some way to get actual time via JavaScript,
I'm trying to figure out a way of how to be able to assign
I am trying to figure out my way through c89 and now I ma
I am trying to figure out a way to cut out a certain region
I'm trying to figure out a way to limit the dragging option of the
I'm trying to figure out a way to re-use the validation rules of Yii's
I am trying to figure out a way to pre-process few things before my
I'm trying to figure out a way to use tar+pipes on a Ubuntu Server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.