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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:29:44+00:00 2026-05-23T13:29:44+00:00

Solution: A bit of tracing showed the CommunicationException was being thrown because there was

  • 0

Solution:

A bit of tracing showed the CommunicationException was being thrown because there was an issue with my exception T not serializing correctly; because, two layers deep, I had an anonymously typed object, which was unserializable. Removing it and bubbling up the changes appeared to fix it. There was somethinge else small I did before that, but I can’t remember for the life of me what it was, only that it wasn’t done in the config.

I was getting messages from my traces such as:

Type 'RebuiltWCFService.Requests.HelloWorldRequest' with data contract name 'HelloWorldRequest:http://schemas.datacontract.org/2004/07/RebuiltWCFService.Requests' is not expected. 
Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

Original post

I’ve encountered a seemingly strange issue today that I just cant’t find an answer to!

The problem: my service is throwing a CommunicationException when I throw a FaultException! It does not do this if I don’t throw an exception.

In my service, I’m properly defining the fault contracts:

[OperationContract]
[FaultContract(typeof(Faults.HelloWorldFault))]
Responses.HelloWorldResponse HelloWorld(Requests.HelloWorldRequest parameter);

Then under error conditions I’m throwing an exception of the correct type:

if (_errors.Count() > 0)
{
    Faults.HelloWorldFault fault = new Faults.HelloWorldFault(_errors);
    throw new FaultException<Faults.HelloWorldFault>(fault, new FaultReason("There are one or more errors in the request. Check the 'Errors' property for more detaisl"));
}

And then I’m catching it on the client end:

try
{
    response = client.HelloWorld(new BasicService.HelloWorldRequest() { Number = 49 });
    client.Close();
    Console.WriteLine(String.Format("Response message: {0}, Response number: {1}", response.Message, response.Number));
}
catch (FaultException<BasicService.HelloWorldFault> ex)
{
    ...
}

That all seems OK to me, and like it should work. However, as soon as I go to test my error clauses (by providing bad data, such as a missing field), the whole thing dies on me. When I throw my FaultException, the service instead throws a CommunicationException with the message

An error occurred while receiving the HTTP response to http://localhost:8732/Design_Time_Addresses/RebuiltWCFService/Service1/. 
This could be due to the service endpoint binding not using the HTTP protocol. 
This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). 
See server logs for more details.

Can anybody offer some insight on this one? I am using the basicHttp binding, and I’ve also tried it with wsHttp. I will post my config file upon request.

  • 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-23T13:29:45+00:00Added an answer on May 23, 2026 at 1:29 pm

    A FaultException is a child of CommunicationException. So there is nothing wrong in what’s happening in your code.

    If you are uncertain about what the exception is while handling, it is usually reported as CommunicationException. If you want to handle your specific exception in your own way, use the following structure.

    try
    { ... }
    catch (FaultException<MyDemoException> me)
    { ... }
    catch (FaultException fe)
    { ... }
    catch (CommunicationException ce)
    { ... }
    catch (Exception ex)
    { ... }
    

    In the above structure, Exception is parent of CommunicationException. CommunicationException is the parent of FaultException and so on.

    System.Object 
      System.Exception
        System.SystemException
          System.ServiceModel.CommunicationException
            System.ServiceModel.FaultException
              System.ServiceModel.FaultException<TDetail>
                System.ServiceModel.Web.WebFaultException<T>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there anyway to build a solution to target 64 bit environment in vs2003?
Conclusion: Marc B's solution is a 64 Bit, but for 32 Bit I'm not
My solution (for every bit of the input block, there is such a line):
The solution in How to compile a 32-bit binary on a 64-bit linux machine
Mine is a bit of odd solution. I want to scan for a particular
I have done a bit of searching for a solution to wrap text around
Edit: I've got the solution and have described it a bit more at the
I'm looking for the simple solution of how to convert the 32-bit bitmap to
My VS 2008 seems to be acting a bit weird and the solution is
I know this has a stupid solution but, sorry, I'm little bit confused. I

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.