对于有效的请求,Web API会引发“提供的参数数量错误”(Web API throws “The number of provided parameters is wrong” for valid

编程入门 行业动态 更新时间:2024-10-11 19:25:45
对于有效的请求,Web API会引发“提供的参数数量错误”(Web API throws “The number of provided parameters is wrong” for valid Request)

我有一个Web API控制器,其中包含以下方法;

[AllowAnonymous] [HttpPost] [Route("testing")] public Token Testing(string username, string password, string companyName, string groupName, bool acceptedTerms)

这在我的VS 2015本地工作,而不是在远程IIS(Windows Server 2012 R2,IIS 8.5)上工作。

我得到的错误是;

The number of provided parameters for method 'Company.API.Controllers.UserController.Testing' is wrong. Parameter name: parameters

抛出此错误的URL具有所有必需参数; HTTP://主机/测试username=user@gmail.com&password=qwertyui&companyName=XYZ&groupName=ABC&acceptedTerms=true

I've a Web API Controller which has following method in it;

[AllowAnonymous] [HttpPost] [Route("testing")] public Token Testing(string username, string password, string companyName, string groupName, bool acceptedTerms)

This is working locally on my VS 2015 and not working on the Remote IIS (Windows Server 2012 R2, IIS 8.5).

The error I'm getting is;

The number of provided parameters for method 'Company.API.Controllers.UserController.Testing' is wrong. Parameter name: parameters

The URL which throws this error has all the required parameters; http://host/testing?username=user@gmail.com&password=qwertyui&companyName=XYZ&groupName=ABC&acceptedTerms=true

最满意答案

我已通过为Application Pool设置Enable 32-Bit Applications为True来解决此问题; 但我仍然不确定为什么会这样。 有关此的任何更多信息非常感谢。

I have fixed this issue by setting Enable 32-Bit Applications to True for the Application Pool; but I'm still not sure why this happens. Any more information on this is highly appreciated.

更多推荐

parameters,API,The,username,testing,电脑培训,计算机培训,IT培训"/> <meta name

本文发布于:2023-07-06 07:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047445.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数量   错误   参数   Web   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!