我想在 Visual Studio 2015 中創(chuàng)建一個使用 IBM 的 Watson Assistant SDK 的 C# 應用程序,有關(guān)它的信息可以在這里找到。但是,當我去運行我的代碼并初始化 的實例時AssistantService,它會拋出這個 System.Security.VerificationException,彈出窗口突出顯示正在調(diào)用的構(gòu)造函數(shù),上面寫著System.Net.Http.Formatting.dll 中出現(xiàn)類型為“System.Security.VerificationException”的異常,但未在用戶代碼中處理附加信息:方法 System.Net.Http.CloneableExtensions.Clone:類型參數(shù)“System.Net. Http.Headers.MediaTypeHeaderValue' 違反了類型參數(shù) 'T' 的約束。我做了一些研究,顯然知道問題與System.Net.Http我根據(jù)之前線程中的建議恢復到 4.0.0 版的包有關(guān),但無濟于事。如果有幫助,我可以提供有關(guān)我的設置、代碼和錯誤的更多信息。預先感謝有人能夠提供的任何建議。using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;using IBM.WatsonDeveloperCloud.Assistant.v1;namespace Watson_Test{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { AssistantService _assistant; public MainWindow() { InitializeComponent(); _assistant = new AssistantService(); Console.WriteLine("Success!"); } }}
1 回答

叮當貓咪
TA貢獻1776條經(jīng)驗 獲得超12個贊
我想報告此事。我能夠通過將所有包更新到當前版本來解決我的問題,因為由于某些依賴沖突,它不允許我更新 System.Net.Http。之后,我將 System.IO.Compression 恢復到 4.1.0 版,這又是由于依賴關(guān)系將 NETStandard.Library 恢復到 1.6.0 版。
現(xiàn)在一切正常,希望這可以幫助其他人處理此類事情。
- 1 回答
- 0 關(guān)注
- 200 瀏覽
添加回答
舉報
0/150
提交
取消