title: "Could not get any response" in Postman instead of the ModelState error in XML format when sending BadRequest(ModelState)
body: <p>Forgive my ignorance, this is my first attempt at an ASP.Net Core WebAPI.  I'm using AspNetCore.MVC 1.1.4 in case that's relevant.  I am using Postman to test my API.</p>
  
  <p>I have a simple HttpPost which sends back the expected 400 Bad Request. For this test, I am sending malformed XML so my hostMessage doesn't deserialize correctly.  The customer wants all the messages sent and received in XML.</p>
  
  <pre><code>[HttpPost("Message")]
  public IActionResult ReceiveMessage([FromBody] HostMessage hostMessage)
  {
      if (hostMessage == null)
      {
          return BadRequest();
      }
      return Ok();
  }
  </code></pre>
  
  <p>This gets me a nice expected response.
  <a href="https://i.stack.imgur.com/MwszW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MwszW.png" alt="Valid expected Bad Request"></a>
  When I change the code so that it will return the error.</p>
  
  <pre><code>[HttpPost("Message")]
  public IActionResult ReceiveMessage([FromBody] HostMessage hostMessage)
  {
      if (hostMessage == null)
      {
          return BadRequest(ModelState);
      }
      return Ok();
  }
  </code></pre>
  
  <p>I was expecting to get a Status 400 Bad Request with the exception found in the Model State (There was an error deserializing the object) but instead, I get the "Could not get any response"</p>
  
  <p>Model State Error:
  <a href="https://i.stack.imgur.com/ZlKQo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZlKQo.png" alt="Model State Error expected"></a></p>
  
  <p>Actual Postman Response:
  <a href="https://i.stack.imgur.com/gAqwj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gAqwj.png" alt="Actual Postman Response"></a></p>
  
  <p>So the question is, why when I add the ModelState to the Bad Request it no longer returns an expected Bad Request with the error, but instead just says it can't get any response.</p>
  
  <p><strong>Pre Post Edit?</strong>
  Okay figured out while writing this post.  The client wants everything in XML. My configure services are set up like this.</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddMvc()
          .AddMvcOptions(x =&gt; x.InputFormatters.Insert(0, new XmlDataContractSerializerInputFormatter()))
          .AddMvcOptions(x =&gt; x.OutputFormatters.Insert(0, new XmlDataContractSerializerOutputFormatter()));
  }
  </code></pre>
  
  <p>And when I remove the OutputFormatter, I get the expected output in JSON.
  <a href="https://i.stack.imgur.com/wcxIL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wcxIL.png" alt="expected out, but in json"></a></p>
  
  <p>So I've updated my question title and am now asking how I can return the expected ModelState error in XML.</p>