title: The remote server returned an unexpected response: (400) Bad Request
body: <p>I'm getting this error "The remote server returned an unexpected response: (400) Bad Request.".
  I've looked at a lot of threads even at stackoverflow and tried those solutions but they dont work for me...like increasing timeouts and buffersizes..</p>
  
  <p>Here's my code on the server..</p>
  
  <pre><code> protected override System.ServiceModel.ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
      {
  
          BasicHttpBinding basichttpbinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
  
          basichttpbinding.CloseTimeout=TimeSpan.MaxValue;
          basichttpbinding.OpenTimeout=TimeSpan.MaxValue;
          basichttpbinding.ReceiveTimeout=TimeSpan.MaxValue;
          basichttpbinding.SendTimeout=TimeSpan.MaxValue;
         // basichttpbinding.TransferMode = TransferMode.Buffered;
  
          ServiceEndpoint servicepoint=new ServiceEndpoint(ContractDescription.GetContract(serviceType));
           servicepoint.Binding=basichttpbinding;
  
          ServiceHost servicehost = new ServiceHost(serviceType, baseAddresses);
  
          ((ServiceDebugBehavior)servicehost.Description.Behaviors[typeof(ServiceDebugBehavior)]).IncludeExceptionDetailInFaults=true;
  
          servicehost.OpenTimeout = TimeSpan.MaxValue;
          servicehost.CloseTimeout = TimeSpan.MaxValue;
          servicepoint.Binding.SendTimeout = TimeSpan.MaxValue;
          servicepoint.Binding.ReceiveTimeout = TimeSpan.MaxValue;
          basichttpbinding.MaxBufferPoolSize = 999999999;
         // basichttpbinding.MaxConnections = 999999999;
          //basichttpbinding.MaxConnections = 999999999;
          basichttpbinding.MaxReceivedMessageSize = 999999999;
          XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas();
          quotas.MaxArrayLength = 999999999;
          quotas.MaxBytesPerRead = 999999999;
          quotas.MaxDepth = 999999999;
          quotas.MaxNameTableCharCount = 999999999;
          quotas.MaxStringContentLength = 999999999;
          basichttpbinding.ReaderQuotas = quotas;
  
          //foreach (Uri uri in baseAddresses)
          //{
  
          servicehost.AddServiceEndpoint(typeof(IService), basichttpbinding, "");
  
         // }
  
          return servicehost;
      }
  </code></pre>
  
  <p>And here's the code I'm using on the client..</p>
  
  <pre><code> static void Main(string[] args)
          {
              BasicHttpBinding basichttpbinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
              ServiceEndpoint endpoint=new ServiceEndpoint(ContractDescription.GetContract(typeof(IService)));
              endpoint.Binding=basichttpbinding;
  
  
              basichttpbinding.CloseTimeout = TimeSpan.MaxValue;
              basichttpbinding.OpenTimeout = TimeSpan.MaxValue;
              basichttpbinding.ReceiveTimeout = TimeSpan.MaxValue;
              basichttpbinding.SendTimeout = TimeSpan.MaxValue;
              basichttpbinding.TransferMode = TransferMode.Streamed;
  
  
  
              endpoint.Binding.SendTimeout = TimeSpan.MaxValue;
              endpoint.Binding.ReceiveTimeout = TimeSpan.MaxValue;
              basichttpbinding.MaxBufferPoolSize = 999999999;
             // basichttpbinding.MaxConnections = 999999999;
              //basichttpbinding.MaxConnections = 999999999;
              basichttpbinding.MaxReceivedMessageSize = 999999999;
              XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas();
              quotas.MaxArrayLength = 999999999;
              quotas.MaxBytesPerRead = 999999999;
              quotas.MaxDepth = 999999999;
              quotas.MaxNameTableCharCount = 999999999;
              quotas.MaxStringContentLength = 999999999;
              basichttpbinding.ReaderQuotas = quotas;
  
  
  
  
           EndpointAddress address=new EndpointAddress("http://localhost:52855/WCFService1/Service.svc");
  
           ChannelFactory&lt;IService&gt; objClient = new ChannelFactory&lt;IService&gt;(basichttpbinding,address);
  
  
  
           IService obj =   objClient.CreateChannel(address);
           obj.GetData(1);
  
          }
  </code></pre>
  
  <p>Please help me..
  Thanks..</p>
  
  <p>Edit: Please don't say "use a config file" etc. I'm doing this only because I have no other choice and have to do it this way.Thanks</p>
  
  <p><strong>Edit: More detailed info after tracing...</strong></p>
  
  <pre><code>  &lt;/PRE&gt;This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;&lt;/MessageLogTraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;262164&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Information"&gt;0&lt;/SubType&gt;&lt;Level&gt;8&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:42.6268846Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{927d4271-a71b-43e6-a8c8-b5b69f5a1b4d}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="6" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.MessageSent.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Sent a message over a channel.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;Source&gt;System.ServiceModel.Activation.HostedHttpContext+HostedRequestHttpOutput/65311427&lt;/Source&gt;&lt;ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTraceRecord"&gt;&lt;MessageProperties&gt;&lt;Encoder&gt;application/xml; charset=utf-8&lt;/Encoder&gt;&lt;AllowOutputBatching&gt;False&lt;/AllowOutputBatching&gt;&lt;/MessageProperties&gt;&lt;MessageHeaders&gt;&lt;/MessageHeaders&gt;&lt;/ExtendedData&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;131085&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Stop"&gt;0&lt;/SubType&gt;&lt;Level&gt;255&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:42.6278847Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{927d4271-a71b-43e6-a8c8-b5b69f5a1b4d}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="6" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Stop"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Activity boundary.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"&gt;&lt;ActivityName&gt;Process action ''.&lt;/ActivityName&gt;&lt;ActivityType&gt;ProcessAction&lt;/ActivityType&gt;&lt;/ExtendedData&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;262168&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Information"&gt;0&lt;/SubType&gt;&lt;Level&gt;8&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2142614Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{a38d441f-464e-4816-a084-8d6c8b484b59}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.ConnectToIPEndpoint.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Connection information.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;Source&gt;System.ServiceModel.Activation.HostedHttpTransportManager/5669220&lt;/Source&gt;&lt;ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"&gt;&lt;LocalEndpoint&gt;::1:52855&lt;/LocalEndpoint&gt;&lt;RemoteEndpoint&gt;::1:0&lt;/RemoteEndpoint&gt;&lt;/ExtendedData&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;0&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Transfer"&gt;0&lt;/SubType&gt;&lt;Level&gt;255&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2142614Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{a38d441f-464e-4816-a084-8d6c8b484b59}" RelatedActivityID="{91bc1c27-5688-4e02-956b-48a9a7e6872c}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;131085&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Suspend"&gt;0&lt;/SubType&gt;&lt;Level&gt;255&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2142614Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{a38d441f-464e-4816-a084-8d6c8b484b59}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Suspend"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Activity boundary.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"&gt;&lt;ActivityName&gt;Listen at 'http://localhost:52855/WCFService1/Service.svc'.&lt;/ActivityName&gt;&lt;ActivityType&gt;ListenAt&lt;/ActivityType&gt;&lt;/ExtendedData&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;131085&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Start"&gt;0&lt;/SubType&gt;&lt;Level&gt;255&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2142614Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{91bc1c27-5688-4e02-956b-48a9a7e6872c}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Start"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Activity boundary.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"&gt;&lt;ActivityName&gt;Processing message 2.&lt;/ActivityName&gt;&lt;ActivityType&gt;ProcessMessage&lt;/ActivityType&gt;&lt;/ExtendedData&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;0&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Transfer"&gt;0&lt;/SubType&gt;&lt;Level&gt;255&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2142614Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{91bc1c27-5688-4e02-956b-48a9a7e6872c}" RelatedActivityID="{a38d441f-464e-4816-a084-8d6c8b484b59}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;131085&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Stop"&gt;0&lt;/SubType&gt;&lt;Level&gt;255&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2142614Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{91bc1c27-5688-4e02-956b-48a9a7e6872c}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Stop"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Activity boundary.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"&gt;&lt;ActivityName&gt;Processing message 2.&lt;/ActivityName&gt;&lt;ActivityType&gt;ProcessMessage&lt;/ActivityType&gt;&lt;/ExtendedData&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;131085&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Resume"&gt;0&lt;/SubType&gt;&lt;Level&gt;255&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2142614Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{a38d441f-464e-4816-a084-8d6c8b484b59}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Resume"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ActivityBoundary.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Activity boundary.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"&gt;&lt;ActivityName&gt;Listen at 'http://localhost:52855/WCFService1/Service.svc'.&lt;/ActivityName&gt;&lt;ActivityType&gt;ListenAt&lt;/ActivityType&gt;&lt;/ExtendedData&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;131075&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Error"&gt;0&lt;/SubType&gt;&lt;Level&gt;2&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2172616Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{a38d441f-464e-4816-a084-8d6c8b484b59}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Throwing an exception.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;Exception&gt;&lt;ExceptionType&gt;System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/ExceptionType&gt;&lt;Message&gt;There is a problem with the XML that was received from the network. See inner exception for more details.&lt;/Message&gt;&lt;StackTrace&gt;   at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
     at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
     at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
     at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
     at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
     at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
  &lt;/StackTrace&gt;&lt;ExceptionString&gt;System.ServiceModel.ProtocolException: There is a problem with the XML that was received from the network. See inner exception for more details. ---&amp;amp;gt; System.Xml.XmlException: The body of the message cannot be read because it is empty.
     --- End of inner exception stack trace ---&lt;/ExceptionString&gt;&lt;InnerException&gt;&lt;ExceptionType&gt;System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/ExceptionType&gt;&lt;Message&gt;The body of the message cannot be read because it is empty.&lt;/Message&gt;&lt;StackTrace&gt;   at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
     at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
     at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
     at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
     at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
     at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
  &lt;/StackTrace&gt;&lt;ExceptionString&gt;System.Xml.XmlException: The body of the message cannot be read because it is empty.&lt;/ExceptionString&gt;&lt;/InnerException&gt;&lt;/Exception&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;262164&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Information"&gt;0&lt;/SubType&gt;&lt;Level&gt;8&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.2912658Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{a38d441f-464e-4816-a084-8d6c8b484b59}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Channels.MessageSent.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Sent a message over a channel.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;Source&gt;System.ServiceModel.Activation.HostedHttpContext+HostedRequestHttpOutput/2389992&lt;/Source&gt;&lt;ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/MessageTraceRecord"&gt;&lt;MessageProperties&gt;&lt;AllowOutputBatching&gt;False&lt;/AllowOutputBatching&gt;&lt;/MessageProperties&gt;&lt;MessageHeaders&gt;&lt;/MessageHeaders&gt;&lt;/ExtendedData&gt;&lt;/TraceRecord&gt;&lt;/DataItem&gt;&lt;/TraceData&gt;&lt;/ApplicationData&gt;&lt;/E2ETraceEvent&gt;&lt;E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent"&gt;&lt;System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system"&gt;&lt;EventID&gt;131076&lt;/EventID&gt;&lt;Type&gt;3&lt;/Type&gt;&lt;SubType Name="Information"&gt;0&lt;/SubType&gt;&lt;Level&gt;8&lt;/Level&gt;&lt;TimeCreated SystemTime="2011-05-14T07:42:49.3462690Z" /&gt;&lt;Source Name="System.ServiceModel" /&gt;&lt;Correlation ActivityID="{a38d441f-464e-4816-a084-8d6c8b484b59}" /&gt;&lt;Execution ProcessName="WebDev.WebServer40" ProcessID="4596" ThreadID="9" /&gt;&lt;Channel/&gt;&lt;Computer&gt;UNIQUETOP&lt;/Computer&gt;&lt;/System&gt;&lt;ApplicationData&gt;&lt;TraceData&gt;&lt;DataItem&gt;&lt;TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Information"&gt;&lt;TraceIdentifier&gt;http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.TraceHandledException.aspx&lt;/TraceIdentifier&gt;&lt;Description&gt;Handling an exception.&lt;/Description&gt;&lt;AppDomain&gt;46847491-1-129498325594327019&lt;/AppDomain&gt;&lt;Exception&gt;&lt;ExceptionType&gt;System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/ExceptionType&gt;&lt;Message&gt;There is a problem with the XML that was received from the network. See inner exception for more details.&lt;/Message&gt;&lt;StackTrace&gt;   at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
     at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)&lt;/StackTrace&gt;&lt;ExceptionString&gt;System.ServiceModel.ProtocolException: There is a problem with the XML that was received from the network. See inner exception for more details. ---&amp;amp;gt; System.Xml.XmlException: The body of the message cannot be read because it is empty.
     --- End of inner exception stack trace ---
     at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
     at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)&lt;/ExceptionString&gt;&lt;InnerException&gt;&lt;ExceptionType&gt;System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/ExceptionType&gt;&lt;Message&gt;The body of the message cannot be read because it is empty.&lt;/Message&gt;&lt;StackTrace&gt;   at System.ServiceModel.Diagnostics.ExceptionUtility.TraceHandledException(Exception exception, TraceEventType eventType)
     at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
     at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
     at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
     at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
     at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
     at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
  </code></pre>