调用此方法:
public HttpResponseMessage PostProduct(Product item)
{
item = repository.Add(item);
var response = this.Request.CreateResponse<Product>CreateResponse(HttpStatusCode.Created, item);
string uri = Url.RouteUrl("DefaultApi", new { id = item.Id });
response.Headers.Location = new Uri(uri);
return response;
}
导致编译时错误:
'System.Web.HttpRequestBase' does not contain a definition for 'CreateResponse' and the
best extension method overload 'System.Net.Http.HttpRequestMessageExtensions.CreateResponse<T>
(System.Net.Http.HttpRequestMessage, System.Net.HttpStatusCode, T)' has some invalid arguments.
我在这里想念什么?