HttpClient & HttpResponseMessage missing in VS 2010 - its for consume REST services
Asked Answered
C

3

6

does anyone know if HttpClient & HttpResponseMessage classes are available in VS 2010? I can't seem to get them to work, do i need to add a reference or using namespace?

These classes were originally from the starter kit for REST for Vs 2008... In vs 2010 its built in i.e. no use for the starter kit...

But how do I cosume them if these classes are missing...

I have searched google for an answer and all i keep finding is examples for vs 2008 i.e. the REST starter kit.

Any help really appreciated

Thanks in advance

Chessy answered 8/8, 2010 at 11:0 Comment(5)
I have wondered about that myself - but since I didn't really need it, I never pursued it. I'll be anxious to see what answers you get! In the meantime, you could check out REST# at restsharp.org - looks pretty nifty and useful!Bolen
Hi !... yes it seems strange to me that the REST server part is included with vs 2010 but the client i don't seem to be able to access it.... Fingers crossed somebody as a solution... THanks for the link, i will keep it just in case... I would prefer to go the pure vs 2010 way - if one exists. Best regardsChessy
the fate of the class library was in limbo for a while, but it has a new home now and there is a team in place who are working hard on bringing it into the .net framework. There is also effort underway, led by Glenn Block of MEF and Prism fame, to bring much better REST support in the framwork v.next. The architect on the team is one of the authors of the HTTP 1.1 spec so they know what they are doing. I expect to see releases on Codeplex soon that will be MS-PL.Unit
ah ok, thanks for the confirmation... This makes my life a little easier... i can just follow the examples for the Rest Starter kit until the new updated 1 is released... Once again thank you for your comments.much appreciatedChessy
In case anybody else has the same issue there is a link here for vs2010 and as Darrel stated it still uses the Starter Kit for client.. blogs.msdn.com/b/endpoint/archive/2010/01/11/…Chessy
U
1

No they are not. They will be in the next version of the .Net framework. Until then you will need to continue using the ones from the WCF REST Starter kit.

Unit answered 8/8, 2010 at 12:4 Comment(3)
Hi Darrel, ahh so they don't exist in .net 4.0? So basically i can built my REST services using standard vs 2010 etc i.e. NO rest starter kit ... but to build the client i must use the rest starter kit. Is this correct? ....Chessy
@mark Must is a strong word. You have the option of using the Microsoft.Http library to access your REST services. I never really considered the Microsoft.Http library part of the REST starter kit, even though it was packaged with it. I use the HttpClient to access REST services that I have built with my own non-WCF framework.Unit
ah ok Darrel, yes agreed i see my open source alternatives for using rest clients... I will stick with the HHTP library from microsoft... THanks once again for all your helpChessy
E
4

Use NuGet to install the WebApi.All:

  1. from VS2010 menubar: View -> Other Windows -> Package Manager Console
  2. from Package Manager Console type in the command Install-Package WebApi.All
  3. in .cs add "using System.Net.Http;"
Execrable answered 8/9, 2011 at 10:39 Comment(0)
U
1

No they are not. They will be in the next version of the .Net framework. Until then you will need to continue using the ones from the WCF REST Starter kit.

Unit answered 8/8, 2010 at 12:4 Comment(3)
Hi Darrel, ahh so they don't exist in .net 4.0? So basically i can built my REST services using standard vs 2010 etc i.e. NO rest starter kit ... but to build the client i must use the rest starter kit. Is this correct? ....Chessy
@mark Must is a strong word. You have the option of using the Microsoft.Http library to access your REST services. I never really considered the Microsoft.Http library part of the REST starter kit, even though it was packaged with it. I use the HttpClient to access REST services that I have built with my own non-WCF framework.Unit
ah ok Darrel, yes agreed i see my open source alternatives for using rest clients... I will stick with the HHTP library from microsoft... THanks once again for all your helpChessy
A
0

In adition to @RAM's answer, don't forget to include both

  • System.Net.Http.dll
  • System.Net.Http.WebRequest.dll

I had this problem with references and had them removed manually in order to clean some unused stuff. I'm mixing MVC with WebApi which sometimes gives me trouble. Anyway, that was it for me. I hope it helps someone.

Appetence answered 27/2, 2013 at 12:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.