title: Why isn't FromQuery working in my ASP.Net Core 1.1 controller action
body: <p>I am working on an ASP.Net Core 1.1 web API. I have a ServiceTypeCode controller as shown below;</p>
  
  <pre><code>[Produces("application/json")]
  [Route("api/[controller]")]
  public class ServiceTypeCodeController : Controller
  { 
      ...
      ...
      ...
  
  
      [HttpGet]
      public IActionResult Get([FromQuery] string a_query)
      {
          try
          {
              if (string.IsNullOrEmpty(a_query))
              {
                  OperationResult&lt;List&lt;ServiceTypeCode&gt;, string&gt; result = m_bl.GetAllServiceTypeCodes();
                  if (result.Success &amp;&amp; result.Result.Count &gt; 0)
                  {
                      return Ok(JsonConvert.SerializeObject(result.Result));
                  }
              } else
              {
                  // Deserialize query into dictionary of strings and StringValues 
                  var query = QueryHelpers.ParseQuery(a_query.ToLower());
  
                  if (query.TryGetValue("mailclasscode", out var mailClassCode))
                  {
                      if (!string.IsNullOrEmpty(mailClassCode))
                      {
                          OperationResult&lt;List&lt;ServiceTypeCode&gt;, string&gt; result = m_bl.GetAllServiceTypeCodes(mailClassCode);
                          if (result.Success &amp;&amp; result.Result.Count &gt; 0)
                          {
                              return Ok(JsonConvert.SerializeObject(result.Result));
                          }
                      }
                  }
                  if (query.TryGetValue("stc", out var stc))
                  {
                      if (!string.IsNullOrEmpty(stc))
                      {
                          OperationResult&lt;ServiceTypeCode, string&gt; result = m_bl.GetServiceTypeCode(stc);
                          if (result.Success)
                          {
                              return Ok(JsonConvert.SerializeObject(result.Result));
                          }
                      }
                  }
              }
              return NotFound();
          }
          catch (Exception ex)
          {
              string msg = "An exception occurred while trying to get a list of ServiceTypeCodes from the database.";
              m_logger.LogError(1, ex, msg);
              ApiError error = BuildError("Server Error - Exception", "500", "Get", ex, msg);
              return Ok(JsonConvert.SerializeObject(error));
          }
  
      }
  </code></pre>
  
  <p>If I use the url ... </p>
  
  <pre><code>http://localhost:5000/api/servicetypecodes
  </code></pre>
  
  <p>in PostMan with the GET verb, I get the list of service type codes, as expected. However, If I try to add anything as a query string, such as ... </p>
  
  <pre><code>http://localhost:5000/api/servicetypecodes?mailclasscode=fc
  </code></pre>
  
  <p>and set a breakpoint in my code at the </p>
  
  <pre><code>if (string.IsNullOrEmpty(a_query))
  </code></pre>
  
  <p>location, the value of a_query is null instead of the expected "mailclasscode=fc"</p>
  
  <p>What am I missing here?</p>
  
  <p>Thanks in advance for any help.</p>