asp.net-web-api - 哪个 IIS 配置会导致特定调用出现“405 Method not allowed”错误?
问题描述
在我们当前的 WebAPI 调用中,只有少数特定的调用返回 405 错误消息(405 Method not allowed),其余的工作正常。失败的只是在特定环境中失败,在所有其他环境中,所有调用都返回 200 并且一切都是洁净的。
哪个 IIS 设置或系统设置会导致这种情况?我正在放大这个,因为这看起来更像是一个系统/配置问题。
Request URL : <hostname/GetAllStuff?userId=johndoe&sortByCustom=CreatedDate&sortByOrder=desc
Request Method: GET
Status Code: 405 Method Not Allowed
Remote Address: 172.72.78.33:443
Referrer Policy: no-referrer-when-downgrade
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Origin: *
Allow: GET,POST,DELETE,PUT
Cache-Control: no-cache
Content-Length: 136
Content-Type: application/json; charset=utf-8
Date: Tue, 06 Nov 2018 17:16:28 GMT
Expires: -1
响应看起来像这样。奇怪的是,所有 API 调用都是 1.0(api-version: 1.0),但只有几个调用会抛出这个错误,而且在特定环境中也是如此。
{ "Error": { "Code": "UnsupportedApiVersion", "Message": "API 版本 '1.0' 的请求资源不支持 HTTP 方法 'GET'。" } }
解决方案
推荐阅读
- events - Meteor 'click' 事件,在事件期间等待订阅
- javascript - 等待数组中每个项目的承诺
- javascript - jquery手风琴式页面标签导航
- c# - ScrollViewer 如何缩放滚动?
- c++ - 条件变量可以“错过”通知调用吗?
- asp.net - ASP .net 实体框架导航属性错误
- grep - 从文件中提取 IP 地址
- performance - Spark:从 RDD、.take() 或 .filterByRange() 中获取 N 个元素?
- c++ - 将 unsigned char 字符数组转换为 int C++
- css - 在 github 页面站点上显示 404 的 css