Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

ASP.NET IIS10 service.svc error 406 not acceptable

Hi there, 

i have a service .svc hosted on a machine whit windows server 2019 on IIS 10, im tryng to send a POST request whit postman sending a json whit the following headers:

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 in the response,

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."

the server/service read the json and respond corretly couse the number of order 12345 was an example and dosent exist,

but whit status code 406 not accetable,

i tryed also to add the header Accept-Charset: UTF-8 in the request but the situation dosent change,

i checked on iis on the server and after select on the mime type list i can that application/json is in the list, 

maybe i have to enable it somewhere else? Specify the mime type in the web.config file?

or it could be something else?

thanks in advance