System.Net.Http.HttpClient VS Windows.Web.Http.HttpClient - 主要有哪些区别? [英] System.Net.Http.HttpClient vs Windows.Web.Http.HttpClient - What are the main differences?

查看:144
本文介绍了System.Net.Http.HttpClient VS Windows.Web.Http.HttpClient - 主要有哪些区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当开发适用于Windows .NET 4.5的桌面应用程序,我一直习惯用 System.Net.Http.HttpClient 与后端的Web API的所有通信。我现在开发一个Windows应用商店的应用程序,并已经注意到 Windows.Web.Http.HttpClient 的存在。我一直在寻求的主要区别是两个客户端之间,但没有任何运气什么样的信息。

When developing .NET 4.5 desktop apps for Windows I have been used to use System.Net.Http.HttpClient for all communication with a backend Web API. I am now developing a Windows Store app and has noticed the existence of Windows.Web.Http.HttpClient. I have looked for information on what the main differences are between the two clients but without any luck.

从MSDN 我知道我应该开始使用 Windows.Web.Http.HttpClient 在我的Windows应用商店的应用程序,因为 System.Net.Http.HttpClient 可从API中删除

From MSDN I know that I should start using Windows.Web.Http.HttpClient in my Windows Store app since System.Net.Http.HttpClient might be removed from the API:

注意的System.Net.Http和System.Net.Http.Headers命名空间可能无法在Windows中使用通过Windows应用商店的应用程序的未来版本。与Windows 8.1和Windows Server 2012 R2起,使用Windows.Web.Http.HttpClient在Windows.Web.Http命名空间和相关Windows.Web.Http.Headers和Windows.Web.Http.Filters命名空间,而不是为Windows运行时的应用程序

Note The System.Net.Http and System.Net.Http.Headers namespace might not be available in future versions of Windows for use by Windows Store apps. Starting with Windows 8.1 and Windows Server 2012 R2, use Windows.Web.Http.HttpClient in the Windows.Web.Http namespace and the related Windows.Web.Http.Headers and Windows.Web.Http.Filters namespaces instead for Windows Runtime apps.

但是,除了这些信息,我有一个很难搞清楚什么是主要的区别,什么是使用的主要好处 Windows.Web.Http.HttpClient ?这是什么补充的是,我们还没有得到在 System.Net.Http.HttpClient

But apart from this information, I have a hard time figuring out what are the main differences and what is the main benefit of using Windows.Web.Http.HttpClient? What does it add that we don't already got in System.Net.Http.HttpClient?

答案由官方文件的支持是很大的AP preciated。

Answers backed by official documentation are greatly appreciated.

推荐答案

没有太多找到它。有些事情来在我的脑海:

There is not much to find about it. Some things that come in my mind:

  • 在新的API不必依赖于一些低级别的Windows功能,就像目前的API一样。
  • 在新的API是能够更好地处理与HTTP协议的新方法,如WebSockets的,等等。

一些有用的信息,可以在这篇博客文章这也参考的这个版本影片。他们谈论更好的缓存控制,和一种添加的过滤器进行身份验证,轻松获得饼干,重新连接,等等。

Some useful information can be found in this blog post which also referenced this Build video. They speak about better cache control, and a way to add filters for authentication, easy access to cookies, reconnecting, etc.

这篇关于System.Net.Http.HttpClient VS Windows.Web.Http.HttpClient - 主要有哪些区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆