I created a WCF service and exposed it as REST service. I am trying to consume this service from ASP.Net MVC3 applic开发者_JAVA百科ation.
I added a reference to Microsoft.Http dll, to use HttpClient and get the response from a POST method of REST service, as in the code below -
string uri = http://localhost:12958/Host1/RestService.svc/SubmitAdvisor;
using (HttpResponseMessage response = new HttpClient().Post(uri, HttpContentExtensions.CreateDataContract(obj)))
{
};
I get the follwing error at runtime -
Could not load file or assembly 'Microsoft.Http, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
What is it I am missing?
Download from this link http://aspnet.codeplex.com/releases/view/24644 After,
Microsoft.Http.dll's location is like this
C:\Program Files (x86)\Microsoft WCF REST\WCF REST Starter Kit Preview 2\Assemblies
精彩评论