How to Consume a Restful Service in .NET?

What are my options to consume a RESTful service using the .Net framework? When is WCF(using the WebChannelFactory) more preferable to HttpClient?


Microsoft`s newest HTTP library is here https://www.nuget.org/packages/Microsoft.Net.Http and I have a blog post showing how to use it here.

You would never want to use WebChannelFactory against a RESTful service. The coupling generated by WebChannelFactory defeats the point of REST.


Check out restsharp. I haven't used it, but am looking into it for consuming our own REST services.


The hammock project makes it very easy to consume RESTful services, you can use it to easily create the required http requests you need:

https://github.com/danielcrenna/hammock

链接地址: http://www.djcxy.com/p/12326.html

上一篇: 无法理解它们

下一篇: 如何在.NET中使用稳定的服务?