JsonConvert.DeserializeObject and “d” wrapper in WCF

后端 未结 7 496
梦谈多话
梦谈多话 2020-12-21 08:53

By default WCF service wrap JSON response in \"d\" wrapper and there I found a problem with parsing it.

If I parse with JsonConvert.DeserializeObject(respons

7条回答
  •  时光取名叫无心
    2020-12-21 09:15

    If you are switching to WebHttpBehavior and you still get an error message about the body elements not being wrapped, manually set the body style of the methods you're dealing with to Wrapped. Do it like so:

    [OperationContract(BodyStyle = WebMessageBodyStyle.Wrapped, ...)] string DoSomething(...)

    Hope this helps!

提交回复
热议问题