C# 使用Flurl时找不到GetJsonAsync方法
我正在尝试使用Flurl调用api,下面是我的请求,它只在我的testserver上失败,但在live server和localhost上也可以工作C# 使用Flurl时找不到GetJsonAsync方法,c#,flurl,C#,Flurl,我正在尝试使用Flurl调用api,下面是我的请求,它只在我的testserver上失败,但在live server和localhost上也可以工作 PickUp responseAsPickUpPointServiceResponse = null; try { responseAsPickUpPointServiceResponse = await new Flurl.Url(_baseUrl + "/r
PickUp responseAsPickUpPointServiceResponse = null;
try
{
responseAsPickUpPointServiceResponse =
await new Flurl.Url(_baseUrl + "/rest//v1/servicepoint/findByPostalCode.json")
.SetQueryParam("apikey", APIKEY_WEB1)
.SetQueryParam("countryCode", countrycode)
.SetQueryParam("postalCode", zipcode)
.WithHeader("Accept", "application/json;charset=UTF-8")
.GetJsonAsync<PickUp>();
}
拾取响应PickupPointServiceResponse=null;
尝试
{
responseAsPickUpPointServiceResponse=
等待新的Flurl.Url(_baseUrl+“/rest//v1/servicepoint/findByPostalCode.json”)
.SetQueryParam(“apikey”,apikey_WEB1)
.SetQueryParam(“国家代码”,国家代码)
.SetQueryParam(“postalCode”,zipcode)
.WithHeader(“接受”、“应用程序/json;字符集=UTF-8”)
.GetJsonAsync();
}
但它失败了
找不到方法:“System.Threading.Tasks.Task`1 Flurl.Http.GeneratedExtensions.GetJsonAsync(Flurl.Http.IFlurlRequest、System.Threading.CancellationToken、System.Net.Http.HttpCompletionOption)
有人知道如何解决这个问题吗?同样,我在运行集成测试时遇到了相同的错误
方法not found[…]GetJsonAsync
,尽管它在单元测试中运行良好
在我的例子中,有两个项目的Flurl.Http
版本不匹配:
main.csproj
imported.csproj
通过将Flurl版本切换到3.0.1
everywhere,修复了该错误:
在这两个文件中:
你知道如何解决这个问题了吗?@jorgachacon不,不幸的是,每次我构建应用程序后,我都必须执行iisreset。。。