如何消费在.NET RESTful服务?NET、RESTful

2023-09-02 01:40:08 作者:夙兴夜寐.

我有哪些选择消耗使用.NET Framework RESTful服务?如果是WCF(使用WebChannelFactory)更preferable到HttpClient的?

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最新的HTTP库是这里的 https://www.nuget.org/packages/Microsoft.Net.Http ,我有一个博客帖子展示了如何使用它的这里。

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.

您绝不会想要使用WebChannelFactory对一个RESTful服务。通过WebChannelFactory产生的耦合击败REST的点

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