title: ASP.NET WEB API not binding to dynamic object on POST
body: <p>If have the following Api Controller ... using StrutureMap for the DI ...</p>
  <pre><code>using System;
  using System.Dynamic;
  using System.Net;
  using System.Net.Http;
  using System.Web.Http;
  using IdentityService.Domain;
  using IdentityService.Domain.Contracts;
  using IdentityService.Domain.Models;
  
  namespace IdentityService.Controllers
  {
      public class AccountController : ApiController
      {
          private readonly IRepository&lt;Client&gt; _clientRepository;
          private readonly IRepository&lt;RelyingParty&gt; _relyingPartyRepository;
          private readonly IRepository&lt;Token&gt; _tokenRepository;
  
          public AccountController(
              IRepository&lt;Client&gt; clientRepository,
              IRepository&lt;RelyingParty&gt; relyingPartyRepository,
              IRepository&lt;Token&gt; tokenRepository)
          {
              _clientRepository = clientRepository;
              _relyingPartyRepository = relyingPartyRepository;
              _tokenRepository = tokenRepository;
          }
  
          public HttpResponseMessage Post(
              [FromBody] dynamic data)
          {
              dynamic result = new ExpandoObject();
  
              try
              {
                  var clientAuthenticator = new ClientAuthenticator(
                      _clientRepository,
                      _relyingPartyRepository,
                      _tokenRepository);
  
                  Token token;
                  clientAuthenticator.Authenticate(
                      data.Key,
                      data.ChecksumValue,
                      data.Checksum,
                      data.Name,
                      data.Password,
                      out token);
  
                  result.Token = token;
              }
              catch (Exception ex)
              {
                  result.ErrorCode = ex.GetType().ToString();
                  result.ErrorMessage = ex.GetBaseException().Message;
              }
  
              return this.Request.CreateResponse(HttpStatusCode.OK, (ExpandoObject)result);
          }
      }
  }
  </code></pre>
  <p>Using Fiddler, I am make the following post:</p>
  <pre><code>POST http://localhost:54029/api/account HTTP/1.1
  User-Agent: Fiddler
  Host: localhost:54029
  Content-Type: &quot;application/json&quot;
  Content-Length: 218
  
  {
      &quot;Key&quot;: &quot;7d42276d3c3954716c672543385b575836472f5d543d7776205627413a&quot;,
      &quot;ChecksumValue&quot;: &quot;127.0.0.1&quot;,
      &quot;Checksum&quot;: &quot;ao4Ei77BaX1/iMZMTAJxWzt4fxc=&quot;,
      &quot;Name&quot;: &quot;USER_NAME&quot;,
      &quot;Password&quot;: &quot;PASSWORD&quot;
  }
  </code></pre>
  <p>Any idea why my data would be null? I have tried switching to <code>JObject</code>, with no success. All the examples I have found makes me think this should work.</p>
  <p>Here is the complete response:</p>
  <pre><code>HTTP/1.1 200 OK
  Cache-Control: no-cache
  Pragma: no-cache
  Content-Type: application/json; charset=utf-8
  Expires: -1
  Server: Microsoft-IIS/8.0
  X-AspNet-Version: 4.0.30319
  X-SourceFiles: =?UTF-8?B?QzpcY29kZS1tYXR0cnVtYVx0YWxrLWF1dGhlbnRpY2F0aW9uLXNlcnZlclxJZGVudGl0eVNlcnZpY2VcYXBpXGFjY291bnQ=?=
  X-Powered-By: ASP.NET
  Date: Mon, 27 May 2013 13:59:45 GMT
  Content-Length: 137
  
  {&quot;ErrorCode&quot;:&quot;Microsoft.CSharp.RuntimeBinder.RuntimeBinderException&quot;,&quot;ErrorMessage&quot;:&quot;Cannot perform runtime binding on a null reference&quot;}
  </code></pre>
  <p>Any help would be much appreciated!</p>
  <p><strong>Update</strong></p>
  <p>I tried just a simple example, like:</p>
  <pre><code>public async Task&lt;dynamic&gt; Post(dynamic data)
  {
       var body = await Request.Content.ReadAsStringAsync();
  
       return data;
  }
  </code></pre>
  <p>The parameter <code>data</code> is still <code>null</code>, but I can see the values in <code>body</code>.</p>