WCF RESTful web service with JSON.Net: avoid double serialization

前端 未结 1 684
无人共我
无人共我 2021-01-01 05:48

Long time lurcher, first time poster here. I\'ve been grappling with this problem for a few days now and would appreciate any tips. I break down the issue here below.

<
相关标签:
1条回答
  • 2021-01-01 06:05

    As I understand you are creating service from scratch and there are no limitations on how REST service will be implemented. Then I suggest you to use ASP.NET WebApi

    http://www.asp.net/web-api

    Do not use legacy web services technologies because in newers a lot of boilerplate code is already done for you.

    With web api you can easily replace or add any serializer/formatter. How to do it is described in following articles:

    http://www.asp.net/web-api/overview/formats-and-model-binding/media-formatters

    http://www.asp.net/web-api/overview/formats-and-model-binding/json-and-xml-serialization

    I've experienced problems with serialization that you've described and solved them with this approach. From my experience on older web services technologies ( WCF 3.5 Rest Starter Kit, Wcf 4 REST) it could be done in much harder way.

    0 讨论(0)
提交回复
热议问题