[英]Using HttpClient with .NET Core Console application
I am trying to access a REST service using the HttpClient in the Microsoft.AspNet.WebApi.Client package 我正在尝试使用Microsoft.AspNet.WebApi.Client包中的HttpClient访问REST服务
But when i try to build my application i get the following error 但是当我尝试构建我的应用程序时,出现以下错误
Project ProjectTest (.NETCoreApp,Version=v1.0) will be compiled because inputs were modified
Compiling ProjectTest for .NETCoreApp,Version=v1.0
/.../code/.../src/ProjectTest/project.json(11,46): error NU1002:
The dependency Microsoft.AspNet.WebApi.Client 5.2.3
does not support framework .NETCoreApp,Version=v1.0.
My project.json contains the following 我的project.json包含以下内容
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0-rc2-3002702"
},
"Microsoft.AspNet.WebApi.Client": "5.2.3"
},
"frameworks": {
"netcoreapp1.0": {
"imports":"dnxcore50"
}
}
}
You are referencing the ASP.NET version of HttpClient. 您正在引用HttpClient的ASP.NET版本。 There exist one in System.Net.Http.HttpClient as well, maybe you have better luck with that one. System.Net.Http.HttpClient中也存在一个,也许您对此比较幸运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.