问题描述
我在 IIS 10 上装有 Windows Server 2019 的机器上托管了一个服务 .svc,
我正在尝试发送 POST 请求,邮递员发送带有以下标头的 json:
Postman-Token: calculated when request is sent>
Content-Lenght: calculated when request is sent
Host: calculated when request is sent
Accept: * / *
Content-Type: application/json
and this in the body:
{
"orderNumber": "12345","idTransaction":"1","authorization":"auth","amount":"14.95","paymentDate":"2020-01-01","currency":"euro","resultCode": "ok"
}
the service responds correctly and read the json but the status is "406 Not Accettable"
as you can see i have placed the Accept header whit value "* / *" that mean accept every kind of content-type and that is the response that i get
response headers:
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/10.0
X-Powered-By: ASP.NET
Date: Mon,04 Jan 2021 09:54:27 GMT
Content-Length: 69
response body
"Not found any payment whit numeroOrdine=12345."
服务器/服务读取json并正确响应,因为订单数量为12345,并且不存在,
但是状态码 406 不可接受,
我也尝试在请求中添加标题 Accept-Charset: UTF-8 但情况没有改变,
我检查了服务器上的 iis,在选择 mime 类型列表后,我可以发现 application/json 在列表中, Mime type IIS
也许我必须在其他地方启用它?在 web.config 文件中指定 mime 类型?
或者它可能是别的东西?
提前致谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)