我的应用程序向aspnetcore控制器发帖。
抛出此错误消息:
FormatException: "Invalid values '*/*; q=0.5; application/json'."
我没有看到它有什么问题。
这是原始帖子:
POST /api/attachments/save HTTP/1.1
Host: localhost:4000
Connection: keep-alive
Content-Length: 130897
Pragma: no-cache
Cache-Control: no-cache
Accept: */*; q=0.5; application/json
Origin: http://localhost:4000
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryDBTUPFcCjjuB8Z1p
Referer: http://localhost:4000/
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Cookie: ai_user=7qQV6|2016-06-29T23:52:02.982Z
如何解决此问题?
答案 0 :(得分:1)
您应该在,
之前使用;
代替application/json
:
Accept: */*; q=0.5, application/json
标准HTTP / 1.1标头字段的语法和语义在Header Field Definitions
中描述