[英]405 on POST request, unsupported method is GET
我遇到了以下问题,我有一个 ASP.NET Web API,当在开发机器上发出一个 POST 请求时,我得到了预期的输出,但是在 IIS 上部署后,我得到回应
"message": "The requested resource does not support http method 'GET'."
我已经阅读了以下帖子,但在 IIS 中闲逛了一段时间后,我并没有从中得到多少。 https://docs.microsoft.com/en-us/aspnet/web-api/overview/testing-and-debugging/troubleshooting-http-405-errors-after-publishing-web-api-applications
该方法的开头如下所示
[HttpPost]
[Route("something/CandidatePersonal")]
public IHttpActionResult PostCandidatePersonal(CanPersonal apiPostInput)
考虑到一切顺利,它返回一个 OK 语句。
关于您的场景,您需要在API
方法上添加[AcceptVerbs("GET", "POST")]
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.