IIS 10 ASP.NET service.svc error 406 Not Acceptable helpRSS

1 reply

Last post Jan 05, 2021 03:19 AM by samwu

  • IIS 10 ASP.NET service.svc error 406 Not Acceptable help

    Jan 04, 2021 01:24 PM|ErickDraven|LINK

    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

  • Re: IIS 10 ASP.NET service.svc error 406 Not Acceptable help

    Jan 05, 2021 03:19 AM|samwu|LINK

    Hi ErickDraven,

    ErickDraven

    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?

    You also need check whether static content feature has been installed.

    Please go to Turn windows features on or off->internet information service->world wide web services->common http features->static content.

    If it still does not work, please use failed request tracking to get more detailed error information.

    Best regards,

    Sam

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.