I have a Web API action that looks like the following:
[HttpGet]
[Route("api/query/hello/{query}")]
public HttpResponseMessage Hello([FromUri]Query query)
{
    return null;
}
where the Query class has a public string property named QueryText.  When I hit the following URL, I get a 404 error:
/api/query/hello?QueryText=bacon
This worked before I started using Attribute Routing.  If I have no parameters or primitive type parameters, I can get Attribute Routing to work.  But with a complex parameter, I get 404s.  How does Attribute Routing work with complex action parameters?  Is it compatible with the FromUri attribute?
The solution here was that the {query} token in the Route definition was superfluous.  Removing it, as follows, fixed the issue:
[Route("api/query/hello")]
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With