Instead of using the web services infrastructure provided by .net, I was wondering what your take on rolling my own asp.net page that you can post data to (I guess all the cool kids are calling this REST,) and retrieving a JSON response from. Is there additional overhead in using an aspx page for this purpose that i'm not aware of?
我没有使用.net提供的Web服务基础结构,而是想知道你在滚动我自己的asp.net页面时可以发布数据(我猜所有很酷的孩子都在调用这个REST)并检索JSON响应从。为此目的使用aspx页面是否有额外的开销,我不知道?
4 个解决方案
#1
Even if you'd use existent helper classes, you'd have to implement your own message parsing (including error handling etc.) and thus lose transport transparency (would require more effort to switch to other protocols/formats) unless you implement a communication infrastructure similar to WCF's. And then you might need additional features such as security..... just use WCF if you can ;)
即使您使用现有的帮助程序类,您也必须实现自己的消息解析(包括错误处理等),从而失去传输透明性(需要更多努力才能切换到其他协议/格式),除非您实现通信类似于WCF的基础设施。然后你可能需要额外的功能,如安全.....如果可以,只需使用WCF;)
#2
Yes and no. You can use ASP.NET, even without MVC, to handle this rather effectively. But you probably don't want to use pages. Rather, you should implement IHttpHandlers for your rest actions.
是的,不是。即使没有MVC,您也可以使用ASP.NET来有效地处理这个问题。但是你可能不想使用页面。相反,你应该为你的休息动作实现IHttpHandlers。
As for handling the JSON angle, check out JSON.NET if you don't want to use the baked-in WCF/Scripting stuff.
至于处理JSON角度,如果您不想使用烘焙的WCF / Scripting,请查看JSON.NET。
#3
Actually, if I may, the cool kids are calling REST something that is not ReST at all.
实际上,如果可以的话,那些很酷的孩子正在调用一些非ReST的东西。
http://serialseb.blogspot.com/2009/06/fighting-for-rest-or-tale-of-ice-cream.html
#1
Even if you'd use existent helper classes, you'd have to implement your own message parsing (including error handling etc.) and thus lose transport transparency (would require more effort to switch to other protocols/formats) unless you implement a communication infrastructure similar to WCF's. And then you might need additional features such as security..... just use WCF if you can ;)
即使您使用现有的帮助程序类,您也必须实现自己的消息解析(包括错误处理等),从而失去传输透明性(需要更多努力才能切换到其他协议/格式),除非您实现通信类似于WCF的基础设施。然后你可能需要额外的功能,如安全.....如果可以,只需使用WCF;)
#2
Yes and no. You can use ASP.NET, even without MVC, to handle this rather effectively. But you probably don't want to use pages. Rather, you should implement IHttpHandlers for your rest actions.
是的,不是。即使没有MVC,您也可以使用ASP.NET来有效地处理这个问题。但是你可能不想使用页面。相反,你应该为你的休息动作实现IHttpHandlers。
As for handling the JSON angle, check out JSON.NET if you don't want to use the baked-in WCF/Scripting stuff.
至于处理JSON角度,如果您不想使用烘焙的WCF / Scripting,请查看JSON.NET。
#3
Actually, if I may, the cool kids are calling REST something that is not ReST at all.
实际上,如果可以的话,那些很酷的孩子正在调用一些非ReST的东西。
http://serialseb.blogspot.com/2009/06/fighting-for-rest-or-tale-of-ice-cream.html
#4
You might want to check this post out.
你可能想看一下这篇文章。