首页 > 解决方案 > AbpApiExceptionFilterAttribute - 需要一个值,但请求中不存在

问题描述

我有一个如下的 webapi 控制器:

[ResponseType(typeof(SampleDto))]
public IHttpActionResult GetSample(string name, string guid)

并且请求将名称和 guid 作为查询字符串,例如: http ://www.example.com/api/Controller1/GetSample?name=james&guid=

指南是空的。

当我发出请求时,出现错误:

WARN  2018-09-29 07:04:21,361 [18   ] nHandling.AbpApiExceptionFilterAttribute - Method arguments are not valid! See ValidationErrors for details.
Abp.Runtime.Validation.AbpValidationException: Method arguments are not valid! See ValidationErrors for details.
WARN  2018-09-29 07:04:21,361 [18   ] nHandling.AbpApiExceptionFilterAttribute - There are 2 validation errors:
WARN  2018-09-29 07:04:21,361 [18   ] nHandling.AbpApiExceptionFilterAttribute - A value is required but was not present in the request. (guid.String)
WARN  2018-09-29 07:04:21,361 [18   ] nHandling.AbpApiExceptionFilterAttribute - A value is required but was not present in the request. (guid.String)

我在哪里可以更改验证规则?

标签: aspnetboilerplateasp.net5

解决方案


推荐阅读