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 8619799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:25:38+00:00 2026-06-12T06:25:38+00:00

WCF Newbie alert. I’m reading Learning WCF and Programming WCF Services where both books

  • 0

WCF Newbie alert. I’m reading “Learning WCF” and “Programming WCF Services” where both books recommend throwing FaultException<T>. If T is .NET type “DivideByZeroException” and assuming a FaultContract exists with

[FaultContract(typeof(DivideByZeroException))]

on method “Divide”, will a non-.NET client consuming that WCF service and method be able to understand and process that .NET exception? If yes, is it because the type info (DivideByZeroException) is part of the metadata (because of the FaultContract) that the client has access to and uses?

Thanks for any help.

  • 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-06-12T06:25:39+00:00Added an answer on June 12, 2026 at 6:25 am

    You can throw a FaultContract<DivideByZeroException>, but in general you shouldn’t do that, exactly for the reason you mentioned (*). What is usually recommended is to have a data contract with the information from the exception, such as the exception message, and then have a FaultContract of that type.

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

    And then use

    [FaultContract(typeof(MyErrorDetails))]
    

    (*) Another reason to avoid returning exceptions as faults is that they disclose more information to the client than the client needs; things such as the stack trace are serialized by the exception, but that’s some information internal to the service and shouldn’t be sent to clients.

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

Sidebar

Related Questions

As a .Net hobbyist & newbie, learning c#, WPF, EntityFramework, LLBLgen WCF, I face
I'm a newbie with WCF services, and I'm trying to figure out if is
Its a newbie question, and I have just been learning WCF. Can we change
I am a total newbie to the WCF world. I have an ASP.net (v4)
WCF is Microsoft's replacement for .Net Remoting and Web services. It's critical to understand
am newbie to both WCF and Named pipes. I need a way to securely
I am a complete ASP .NET newbie. I've written a set of web services
I am a newbies programming WCF in .net. Recently, I worked on one of
I am a newbie for WCF, so please educate me. I am trying to
I am relatively new to the WCF world so my applogies for the newbie

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.