更新时间:2022-11-27 19:02:53
http({
method:GET,
url:urlBase +Calculate,
params:{
myBiDimenArray:myBiDimenArray,
intSize:1,
},
header:{
'内容-Type':'application / json',
'X-ApiKey':'test',
'授权':'基本123456'
}
});
http({ method: "GET", url: urlBase + "Calculate", params: { myBiDimenArray: myBiDimenArray, intSize: 1, }, headers: { 'Content-Type': 'application/json', 'X-ApiKey': 'test' , 'Authorization': 'Basic 123456' } });
以下是我在Web APi中的代码:
Below is my code in Web APi:
<HttpGet>
Public Function Calculate(<FromUri> ByVal myBiDimenArray(,) As String, <FromUri> ByVal intSize As Integer) As IHttpActionResult
....
End Function
有什么建议吗?
我是新来的,我搜索过如何创建在vb.net和JavaScript中的Bi-Dimen数组,所以我在我的解决方案中实现了上述内容,但是抛出了错误400,甚至没有访问方法。
更新:
请注意,这是我在webAPi配置文件中的路线:
Any suggestions?
I am new to this, I have searched for how to create Bi-Dimen Array in vb.net and in JavaScript so I implemented the above in my solutions but error 400 is thrown and method is even not accessed.
Update:
Please note that this is my route in webAPi config file:
config.Routes.MapHttpRoute( _
name:="Test_Calculate", _
routeTemplate:="api/{controller}/{action}/{myBiDimenArray}/{intSize}", _
defaults:=New With {.controller = "Test", .action = "Calculate"} _
)
这可能是配置问题吗?
我尝试过:
我已将Web APi方法更改为:
Could it be a configuration problem?
What I have tried:
I have changed the web APi method to this:
<HttpGet>
Public Function Calculate(<FromUri> ByVal myBiDimenArray()() As String, <FromUri> ByVal intSize As Integer) As IHttpActionResult
....
End Function
可以访问该方法,myBiDimenArray长度为3(这是正确的),但内部的每个数组都像String一样,例如:[1 ,6::1个参数,而不是数组中的2个参数;
The method could be accessed, myBiDimenArray length was 3 (which is correct), but each array inside was acting like a String, example: "[1,6]" : 1 parameter instead of being 2 params inside an array;