.Net 2.0 框架和 REST 服务JavaScript 中的 REST 消耗
根据 wikipedia 条款 REST 是
REST 可以被认为是 适合世界各地的建筑风格 网络。建筑风格是 与 HTTP/1.1 并行开发 协议,基于现有设计 HTTP/1.0
REST 实践很久以前就随着 HTTP 的发展而开始了。如果我正确理解这些定义,我们就可以利用现有技术并在其之上构建 REST 服务。
我的要求是在 .Net 2.0 之上构建 RESTFul 服务(我知道这在 WCF 中可以轻松实现,但目前我还没有那么奢侈)。
这可能吗?
如果可以的话请指点我一些 工作示例..
互联网上有博客或著作吗 涵盖本条的实施 方法..?
编辑:
我忘了提及这一点。
- 是否可以使用 javascript 的 REST 服务??
提前致谢
as per wikipedia terms REST is
REST can be considered the
architectural style for the World Wide
Web. The architectural style was
developed in parallel to the HTTP/1.1
protocol, based on the existing design
of HTTP/1.0
REST practices started long time ago along with HTTP evolution. If i understand the defenetions correctly , we can take advantage of existing techologies and can built REST services on top of it.
My requirement is to built RESTFul services on top of .Net 2.0 (i know this can be easily acheivable in WCF, but currently i dont have that luxury).
is this possible??
if possible please point me some
working examples..is there any blogs or writings in internet
covers the implementation of this
approach..?
EDIT:
i forgot to mention this one.
- is it possible to consume the REST services from javascript.??
Thanks in Advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有本书restful .net
为客户尝试一下:http://developer.yahoo.com/dotnet/howto-rest_cs.html 例如
编辑:反映评论:
我发现这篇文章介绍了如何使用http处理程序进行静态服务。
以及如何通过 javascript 使用。
There is a book restful .net
Try this for a client: http://developer.yahoo.com/dotnet/howto-rest_cs.html for example
edit: to reflect comment:
I found this article on how to do a restful serivce with http handlers.
And how to consume via javascript.
除了滚动您自己的 Http 模块之外,我还知道有 3 个主要工具包可用于实现 REST 服务。
Apart from rolling your own Http modules there are 3 main toolkits I know of for implementing REST services.
您可以通过编写自定义处理程序来使其工作。
看看这篇文章。
http://www.codeproject.com/KB/webservices/REST_Web_Service.aspx
我相信在 JavaScript 中使用 REST 服务的最佳选择是获取 json 格式的结果。
在 javascript 中,您通过将格式指定为 json 向服务发出请求,并在服务器端检查格式并将响应数据序列化为 json 格式。
You can get it working by writing custom handlers.
Take a look at this article.
http://www.codeproject.com/KB/webservices/REST_Web_Service.aspx
I believe your best bet to consume REST services in javascript is to get the results in json format.
From javascript you make a request to the service by specifying the format as json and on the server side you check for the format and serialize the response data to json format.
我在 HttpListener 之上构建了自己的 REST 框架,并在 Windows 服务中运行它。完成基本的工作非常容易。然而,随着时间的推移,您将需要大量其他基础设施代码来支持处理 HTTP 的各个方面。如果您是从头开始,请查看 OpenRasta。它将引导您走上正确的道路并节省您大量的时间。
I built my own REST framework on top of HttpListener and run it in an Windows Service. It is pretty easy to get the basic stuff going. However, over time you will need plenty of other infrastructure code to support dealing with all aspects of HTTP. If you are starting from scratch, then check out OpenRasta. It will guide you down the right path and save you a whole lot of time.