Only one complex type allowed as argument to a web api controller action.

时间:2023-03-08 17:10:22
Only one complex type allowed as argument to a web api controller action.

错误内容:

message":"An error has occurred.","exceptionMessage":"Only one complex type allowed as argument to a web api controller action. But ExecuteGetTable contains more than one!","exceptionType":"Abp.AbpException","stackTrace":"   在 Abp.WebApi.Controllers.Dynamic.Scripting.ActionScriptingHelper.GenerateBody(DynamicApiActionInfo actionInfo)

Only one complex type allowed as argument to a web api controller action.


问题原由:

不能在abp框架中的application中定义的api接口方法传入多个复杂类型,只有含一个复杂类型,不然在js侧调用api接口时会出现以上错误。

什么是复杂类型:自定义的类型就是复杂类型


api接口的方法只能有一个复杂类型(返回值、传入参数)

如果通过js调用的接口方法中有其他接口方法嵌套调用,被调用的接口方法只能有一个复杂类型(有多个复杂类型会报死循环的错误)

猜测原因:不停的去容器中找对应接口方法,找不到引发死循环

不能在接口方法中设置DataTable类型的变量