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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:40:29+00:00 2026-06-03T14:40:29+00:00

Is there some difference in the way how the exceptions are handled in regards

  • 0

Is there some difference in the way how the exceptions are handled in regards of the binding used?

I’m getting different results if I use WSHttpBinding or BasicHttpBanding.

For example, this is my error handling routine in the client side:

//MyClient client = new MyClient("WSBinding");
MyClient client = new MyClient("BasicBinding");
try
{

    Result = client.DoTheWork("test");
    Console.WriteLine(Result);
}
catch (FaultException e)
{
    if (e.Code.SubCode.Name.Equals("BadParameters"))
        Console.WriteLine("Bad parameter entered");

    Console.WriteLine(e);
}

I can catch the exception on the client when I use WSHttpBinding, however if I use basicHttpHandling I cann’t, I get:

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.

This is my web.config,

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="basicBinding">
      <security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" />
      </security>
    </binding>
  </basicHttpBinding>   
  <wsHttpBinding>
    <binding name="wsBinding">
      <security mode="None">
        <transport clientCredentialType="None" />
        <message establishSecurityContext="false" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
<services>
  <service name="MailboxServiceLibrary.MailboxService" behaviorConfiguration="ServiceBehavior" >
    <!--endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsBinding" contract="ParServiceLibrary.IParService">
      <identity>
        <dns value="MyServer.com" />
      </identity>
    </endpoint-->     
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicBinding" contract="ParServiceLibrary.IParService"/>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior">
      <serviceMetadata httpGetEnabled="True"/>
      <serviceDebug includeExceptionDetailInFaults="True"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

Seems that BasicHttpBinding uses the Soap 1.1 format and for WSHttpBinding, it uses Soap 1.2 formats but not sure if this can be the cause.

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-06-03T14:40:31+00:00Added an answer on June 3, 2026 at 2:40 pm

    I just realized that I was using a wrong approach to catch the exception in the client site,

    I was using,

    if (e.Code.SubCode.Name.Equals("MyFaultID"))
    

    And it must be,

    if (e.Code.Name.Equals("MyFaultID"))
    

    In this way works fine in both bindings.

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

Sidebar

Related Questions

Is there some difference between the way that bundle resources can be accessed on
There are some different opinions about simple inner classes, so I was wondering if
i've been playing some time with different builds of my application and there seem
I noticed that there's a whole bunch of different content types, some of them
Is there some way when sending this message to specify that I rather have
Is there some way to compile (with the CSC task) a WPF Application with
There are some posts that asks what the difference between those two are already.
Is there a difference in the results returned by Python's built-in pow(x, y) (no
I know that there must be some differences. I have a Silverlight component (
I do know some basic differences but there are still some questions in my

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.