REST from asp.net 2.0

前端 未结 7 437
一生所求
一生所求 2020-12-28 08:34

I just built a asp.net 2.0 web site. Now I need add REST web service so I can communicate with another web application. I\'ve worked with 2 SOAP web service project before,

7条回答
  •  温柔的废话
    2020-12-28 09:32

    You could look at using ASP.NET MVC as a RESTful web services platform. WCF is probably the way to go in the long run, but MVC should easily handle it. Your actions would just need to be set up to return JSON or XML, depending on how you want to serialize it. MVC offers both a JsonResult and fully customizable ContentResult -- i.e., you serialize your response to a string property on the result and set it's type and encoding.

    NOTE: MVC does require 3.5 SP1 so it's not going to be a 2.0 solution. If you require 2.0, you'll need to look elsewhere.

提交回复
热议问题