Content Type text/xml; charset=utf-8 was not supported by service

前端 未结 10 1799
北海茫月
北海茫月 2020-12-01 09:59

I have a problem with a WCF service. I have a console application and I need to consume the service without using app.config, so I had to set the endpoint, etc. by code. I d

10条回答
  •  一生所求
    2020-12-01 10:41

    For anyone who lands here by searching:

    content type 'application/json; charset=utf-8' was not the expected type 'text/xml; charset=utf-8

    or some subset of that error:

    A similar error was caused in my case by building and running a service without proper attributes. I got this error message when I tried to update the service reference in my client application. It was resolved when I correctly applied [DataContract] and [DataMember] attributes to my custom classes.

    This would most likely be applicable if your service was set up and working and then it broke after you edited it.

提交回复
热议问题