Required query string parameter in ASP.NET Core
问题 Using ASP.NET Core 1.1 with VS2015 (sdk 1.0.0-preview2-003131), I have the following controller: public class QueryParameters { public int A { get; set; } public int B { get; set; } } [Route("api/[controller]")] public class ValuesController : Controller { // GET api/values [HttpGet] public IEnumerable<string> Get([FromQuery]QueryParameters parameters) { return new [] { parameters.A.ToString(), parameters.B.ToString() }; } } As you can see, I have two query parameters. What I would like is to