You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

因Watson包问题引发异常:VS2015中Watson Assistant SDK初始化报错

初始化IBM Watson AssistantService时遭遇VerificationException异常求助

我正在Visual Studio 2015里开发一款C#应用,用的是IBM Watson Assistant SDK。但在初始化AssistantService实例的环节,突然抛出了System.Security.VerificationException异常,弹窗里的提示是:

System.Net.Http.Formatting.dll中发生类型为'System.Security.VerificationException'的异常,但未在用户代码中处理。附加信息:方法System.Net.Http.CloneableExtensions.Clone:类型参数'System.Net.Http.Headers.MediaTypeHeaderValue'违反了类型参数'T'的约束。

我已经排查到这个问题和System.Net.Http包有关,之前按照建议把这个包回退到4.0.0版本,可问题还是没解决。我还能提供更多配置细节、代码片段以及完整的错误信息。

下面是我的初始化代码:

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!");
        }
    }
}

程序的完整输出包含更详尽的错误追踪信息。

内容的提问来源于stack exchange,提问作者OutOfCharacters

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 10:17:26