WCFFaultException with an error status code is always being returned back to the client as 202 accepted

106 Views Asked by At

In our application, if required, we are throwing a fault exception as follows:

throw new WebFaultException(new RequestFaultInfo(errorMessage), System.Net.HttpStatusCode.BadRequest);

The RequestFaultInfo class is as follows:

    /// <summary>
    /// Fault information used as the detail of a web service request failure.
    /// </summary>
    [DataContract]
    public class RequestFaultInfo
    {
        #region Constants

        /// <summary>
        /// Summary fault reason.
        /// </summary>
        public const string Reason = "Request failure";

        #endregion

        private string m_errorDescription;

        #region Object Lifetime

        /// <summary>
        /// Constructor specifying the login error description.
        /// </summary>
        /// <param name="errorDescription">Request error description.</param>
        /// <exception cref="ArgumentException">errorDescription is null or empty.</exception>
        public RequestFaultInfo(string errorDescription)
        {
            if (String.IsNullOrEmpty(errorDescription))
            {
                throw new ArgumentException("errorDescription cannot be null or empty", "errorDescription");
            }

            m_errorDescription = errorDescription;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Login error description.
        /// </summary>
        [DataMember]
        public string ErrorDescription 
        { 
            get { return m_errorDescription; }
            private set { m_errorDescription = value; }
        }

        #endregion

However, the client is always getting the status code 202 (Accepted). In this case the client is Postman on the same server.

Has anyone got any ideas why this is happening?

0

There are 0 best solutions below