且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

网页API POST方法返回HTTP / 1.1 500内部服务器错误

更新时间:2022-06-17 18:00:41

在您的文章中的数据不是有效的JSON对象,这是什么模型绑定期待。(内容类型:应用程序/ JSON)

The data in your post is not a valid JSON-object, which is what the model binder is expecting (Content-Type: application/json).

{"iduser"="123456789","username"="orange"}

试着用替换您=:看看你的身体情况如何。您code工作在我的机器上使用请求的改变。

Try replacing your = with : and see how you get on. Your code works on my machine with those alterations in the request.

POST http://localhost:20377/api/test/Postuser HTTP/1.1
Host: localhost:20377
Connection: keep-alive
Content-Length: 42
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
Origin: chrome-extension://fhjcajmcbmldlhcimfajhfbgofnpcjmb
Content-Type: application/json
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,nb;q=0.4,de;q=0.2

{"iduser":"123456789","username":"orange"}