1

我想制作一个使用 C# 备份我的强化防火墙的程序。

我在防火墙上创建了一个配置文件,该配置文件具有读取配置的权限,并且还生成了相同的 API 密钥。

下面是我的示例代码

class Program
{
    public static string urlParameters = "?scope=global&access_token=mytoken";//ill replace mytoken with generated token
    static void Main(string[] args)
    {
        HttpClient httpClient = new HttpClient();
        httpClient.BaseAddress = new Uri("https://x.x.x.x/api/v2/monitor/system/config/backup/");
        HttpResponseMessage responseMessage = httpClient.GetAsync(urlParameters).Result;//Im getting error in this statement
        Console.WriteLine(responseMessage.ToString());
    }
}

我在执行上述代码时遇到 3 个以下错误

  1. HttpRequestException:发送请求时发生错误。

  2. WebException:底层连接已关闭:无法为 SSL/TLS 安全通道建立信任关系。

  3. AuthenticationException:根据验证程序,远程证书无效。

我能够从正在执行程序的系统 ping 防火墙。

4

0 回答 0