What assembly is HttpClient stored in

2019-04-18 15:20发布

I want to use the HttpClient class from the WCF Rest Service to create a client to call rest services. I heard it was rolled into .net 4.0 but don't know the assembly it's stored in.

标签: c# wcf rest
4条回答
Rolldiameter
2楼-- · 2019-04-18 15:26

The WCF REST Starter Kit Preview 2 includes a set of classes designed to simplify interaction with REST web services. The communications are performed using the HttpClient class with the help of other types from the Microsoft.Http namespace. These types can be found in the Microsoft.Http.dll assembly located in the Assemblies folder of the starter kit.

link 1: Introduction to the HttpClient
link 2: msdn.microsoft.com
link 3: How to consume REST in C# including PUT, POST and DELETE?

查看更多
叛逆
3楼-- · 2019-04-18 15:38

According to this MSDN page, it is new in .NET 4.5.

"Supported in: 4.5"

If you're on .NET 4.5, it will be in the System.Net.Http assembly.

查看更多
何必那么认真
4楼-- · 2019-04-18 15:39

While you are waiting for .net 4.5 to roll out, you can get a 4.0 version from Nuget. http://nuget.org/packages/System.Net.Http

查看更多
干净又极端
5楼-- · 2019-04-18 15:42

Just see the documentation:

Namespace: System.Net.Http
Assembly: System.Net.Http (in System.Net.Http.dll)

查看更多
登录 后发表回答