[英]type 'IReportServerCredentials' is defined in an assembly that is not referenced.
[英]The type 'IAsyncOperationWithProgress<,>' is defined in an assembly that is not referenced.
在我的Xamarin.Forms
項目中,我嘗試使用Windows.Web.Http
HttpClient
。 我必須使用它,因為我需要忽略一些SSL錯誤。 當我創建HttpClient
對象並嘗試調用方法時,出現以下錯誤消息:
錯誤CS0012在未引用的程序集中定義了類型'IAsyncOperationWithProgress <,>'。 您必須添加對程序集“ Windows.Foundation.FoundationContract,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = null,ContentType = WindowsRuntime”的引用。
我進行了一些研究,並嘗試了所有發現但無法修復的問題。 我怎樣才能解決這個問題 ? 任何幫助,將不勝感激。
在我的Xamarin.Forms項目中,我嘗試使用Windows.Web.Http的HttpClient。 我必須使用它,因為我需要忽略一些SSL錯誤。 當我創建HttpClient對象並嘗試調用方法時,出現此錯誤消息。
您正在使用Windows.Web.Http
命名空間是特定於平台的。 基礎實現依賴於WindowsRT平台。 因此,它不是跨平台的。
我們建議使用System.Net.Http
HttpClient模塊在Xamarin.Forms應用程序中進行REST API調用。 有關更多信息,請參閱將HttpClient與Xamarin.Forms一起使用 。
用法
HttpClient client = new HttpClient();
var res = await client.GetAsync("http://localhost:5000/api/todo/items");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.