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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:30:43+00:00 2026-06-10T12:30:43+00:00

I am getting The remote server returned an unexpected response: (400) Bad Request when

  • 0

I am getting “The remote server returned an unexpected response: (400) Bad Request” when I try to send more than 100 audit entries. I am using Fiddler to help debug and do see the request being sent to the server. The client and server both use the same interface.

[ServiceContract]
public interface ISyncDataContract
{
    #region Audit Log

    /// <summary>
    /// Creates a collection of new audit entries items in the database.
    /// </summary>
    /// <param name="items">The audit entry items to be created.</param>
    /// <returns><c>True</c> if created successfully; otherwise, <c>false</c>.</returns>
    [OperationContract]
    [WebInvoke(UriTemplate = "AuditEntries", Method = "PUT")]
    bool CreateAuditEntryItems(AuditEntryItemCollection items);

    /// <summary>
    /// Gets all the audit entry items available.
    /// </summary>
    /// <returns>An <see cref="AuditEntryItemCollection"/> object containing all the
    /// available audit entry items.</returns>
    [OperationContract]
    [WebGet(UriTemplate = "AuditEntries")]
    Message GetAuditEntryItems();

    #endregion
}

AuditEntryItem.cs

[DataContract]
public class AuditEntryItem
{
    #region Constructor/Deconstructor

    /// <summary>
    /// Initializes a new instance of the <see cref="AuditEntryItem"/> class.
    /// </summary>
    public AuditEntryItem()
    {
    }

    /// <summary>
    /// Initializes a new instance of the <see cref="AuditEntryItem"/> class.
    /// </summary>
    /// <param name="auditEntry">The audit entry.</param>
    public AuditEntryItem(AuditEntry auditEntry)
    {
        if (auditEntry == null)
        {
            throw new ArgumentNullException("auditEntry");
        }

        this.Audit_Type = auditEntry.Audit_type;
        this.ComputerName = Environment.MachineName;
        this.Message = auditEntry.Message;
        this.Sequence_Number = auditEntry.Sequence_number;
        this.Session_ID = auditEntry.Session_ID;
        this.SyncDate = DateTime.Now;
        this.Time_Stamp = auditEntry.Time_stamp;
        this.User_ID = auditEntry.User_ID;
    }

    #endregion Constructor/Deconstructor

    #region Properties

    /// <summary>
    /// Gets or sets the session ID.
    /// </summary>
    /// <value>
    /// The session ID.
    /// </value>
    [DataMember]
    [XmlElement(ElementName = @"Session_ID")]
    public string Session_ID { get; set; }

    /// <summary>
    /// Gets or sets the user ID.
    /// </summary>
    /// <value>
    /// The user ID.
    /// </value>
    [DataMember]
    [XmlElement(ElementName = @"User_ID")]
    public string User_ID { get; set; }

    /// <summary>
    /// Gets or sets the time stamp.
    /// </summary>
    /// <value>
    /// The time stamp.
    /// </value>
    [DataMember]
    [XmlElement(ElementName = @"Time_Stamp")]
    public string Time_Stamp { get; set; }

    /// <summary>
    /// Gets or sets the sequence number.
    /// </summary>
    /// <value>
    /// The sequence number.
    /// </value>
    [DataMember]
    [XmlElement(ElementName = @"Sequence_number")]
    public int Sequence_Number { get; set; }

    /// <summary>
    /// Gets or sets the message.
    /// </summary>
    /// <value>
    /// The message.
    /// </value>
    [DataMember]
    [XmlElement(ElementName = @"Message")]
    public string Message { get; set; }

    /// <summary>
    /// Gets or sets the type of the audit.
    /// </summary>
    /// <value>
    /// The type of the audit.
    /// </value>
    [DataMember]
    [XmlElement(ElementName = @"Audit_type")]
    public string Audit_Type { get; set; }

    /// <summary>
    /// Gets or sets the name of the computer.
    /// </summary>
    /// <value>
    /// The name of the computer.
    /// </value>
    [DataMember]
    [XmlElement(ElementName = @"ComputerName")]
    public string ComputerName { get; set; }

    /// <summary>
    /// Gets or sets the sync date.
    /// </summary>
    /// <value>
    /// The sync date.
    /// </value>
    [DataMember]
    [XmlElement(ElementName = @"SyncDate")]
    public DateTime? SyncDate { get; set; }

    /// <summary>
    /// Gets the time stamp value in a date time format.
    /// </summary>
    [XmlIgnore]
    public DateTime DisplayTimeStamp
    {
        get { return this.TimeStampDateTime(); }
    }

    #endregion Properties

    #region Overrides

    public override bool Equals(object obj)
    {
        return obj is AuditEntryItem ? this.Equals((AuditEntryItem)obj) : false;
    }

    public bool Equals(AuditEntryItem other)
    {
        if (ReferenceEquals(this, other))
        {
            return true;
        }

        return string.Equals(this.Audit_Type, other.Audit_Type) &&
               string.Equals(this.ComputerName, other.ComputerName) &&
               string.Equals(this.Message, other.Message) &&
               this.Sequence_Number == other.Sequence_Number &&
               string.Equals(this.Session_ID, other.Session_ID) &&
               this.SyncDate == other.SyncDate &&
               string.Equals(this.Time_Stamp, other.Time_Stamp) &&
               string.Equals(this.User_ID, other.User_ID);
    }

    public override int GetHashCode()
    {
        unchecked
        {
            var result = (this.Audit_Type != null ? this.Audit_Type.GetHashCode() : 0);
            result = (result * 397) ^ (this.ComputerName != null ? this.ComputerName.GetHashCode() : 0);
            result = (result * 397) ^ (this.Message != null ? this.Message.GetHashCode() : 0);
            result = (result * 397) ^ this.Sequence_Number.GetHashCode();

            result = (result * 397) ^ (this.Session_ID != null ? this.Session_ID.GetHashCode() : 0);
            result = (result * 397) ^ (this.SyncDate != null ? this.SyncDate.GetHashCode() : 0);
            result = (result * 397) ^ (this.Time_Stamp != null ? this.Time_Stamp.GetHashCode() : 0);
            result = (result * 397) ^ (this.User_ID != null ? this.User_ID.GetHashCode() : 0);
            return result;
        }
    }

    #endregion Overrides

    /// <summary>
    /// Converts the Java time stamp value into a readable format.
    /// </summary>
    /// <returns>A readable date time format.</returns>
    private DateTime TimeStampDateTime()
    {
        if (this.Time_Stamp.IsNullOrEmpty())
        {
            return new DateTime(1970, 01, 01);
        }

        long value;
        if (!long.TryParse(this.Time_Stamp, out value))
        {
            return new DateTime(1970, 01, 01);
        }

        value = value / 1000;
        return new DateTime(1970, 01, 01).AddSeconds(value);
    }
}

AuditEntryItemCollection.cs

[DataContract]
[XmlRoot(ElementName = "AuditLog")]
public class AuditEntryItemCollection
{
    #region Declarations

    #endregion Declarations

    #region Constructor/Deconstructor

    /// <summary>
    /// Initializes a new instance of the <see cref="AuditEntryItemCollection"/> class.
    /// </summary>
    public AuditEntryItemCollection()
    {
        this.AuditEntryItems = new List<AuditEntryItem>();
    }

    #endregion Constructor/Deconstructor

    #region Properties

    /// <summary>
    /// Gets or sets the collection of <see cref="AuditEntryItem"/>
    /// objects.
    /// </summary>
    /// <value>
    /// The collection of <see cref="AuditEntryItem"/> objects.
    /// </value>
    [XmlElement(ElementName = @"AuditEntry")]
    [DataMember]
    public List<AuditEntryItem> AuditEntryItems { get; set; }

    #endregion Properties
}

App.config

<?xml version="1.0" encoding="utf-8" ?>

<behaviors>
  <endpointBehaviors>
    <behavior name="restXmlBehavior">
      <webHttp helpEnabled="true" defaultOutgoingResponseFormat="Xml" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
    <behavior name="rssAtomBehavior">
      <webHttp/>
    </behavior>
  </endpointBehaviors>

  <serviceBehaviors>
    <behavior name="metadataBehavior" >
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

<bindings>
  <webHttpBinding>
    <binding name="StreamedHttp"
             maxReceivedMessageSize="2147483647"
             transferMode="Streamed" >
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="6000000" />
    </binding>
  </webHttpBinding>
</bindings>

UPDATE:

The error I am now getting is “The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.” As far as I can tell, I have already done this. Is there some other setting I need to set?

  • 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-10T12:30:45+00:00Added an answer on June 10, 2026 at 12:30 pm

    You could make sure the httpRuntime is also configured for large requests:

    (An example grabbed from a service I use to upload files:)

    <httpRuntime executionTimeout="3600" maxRequestLength="50000000" maxQueryStringLength="2097151" requestValidationMode="2.0" />
    

    And also perhaps look at the buffer pool sizes on the binding (again, these values are just examples):

     <binding name="WHB" maxReceivedMessageSize="50000000" maxBufferPoolSize="50000000" crossDomainScriptAccessEnabled="true">
              <readerQuotas maxArrayLength="50000000" maxStringContentLength="50000000" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this error The remote server returned an unexpected response: (400) Bad Request..
I'm getting a The remote server returned an error: (400) Bad Request error when
I am getting a {The remote server returned an error: (415) Unsupported Media Type.}
I'm getting a The remote server returned an error: (422) Unprocessable Entity. when trying
I am getting some HTML text from a remote server which I am displaying
I am running a WPF app with a remote server setup but getting The
I'm trying to scp a directory to a remote server, but I'm getting this
I am getting a json object from a remote server, and converting it to
Iam getting OutOfMemoryException while making remote method call. RemoteEntity.SetLocalStore(DATASET); passed value is dataset. Note
I'm getting this error: The remote certificate is invalid according to the validation procedure.

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.