【问题标题】:Test cases are failing vstest.console.exe in docker windows console with https测试用例在 docker windows 控制台中使用 https 失败 vstest.console.exe
【发布时间】:2020-05-04 03:35:48
【问题描述】:

我正在使用带有 Nunit 的 restsharp 运行 API 测试,并且测试用例在 docker windows 中以 vstest.console.exe 失败,得到“0”作为响应。在本地系统上传递时。

我正在从 docker 容器中访问 https 应用程序。

由于 SSL 证书,我通过 HTTP 请求验证它按预期工作。

为了验证我使用的连接

invoke-WebRequest -UseBasicParsing https://hostname

并在容器中收到此错误

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

当我使用 invoke-WebRequest -UseBasicParsing http://hostname 时,我得到 200 个状态码。

【问题讨论】:

    标签: c# .net windows powershell docker


    【解决方案1】:

    此问题与 vstest.console.exe 无关。这个问题是因为 SSL/TLS。由于 CA(证书颁发机构),容器无法与我的应用程序建立 https 连接。

    当我将 CA 导入我的容器时,一切都按预期工作。要导入证书,我使用了 PowerShell 命令

    Import-Certificate -FilePath "file.cer" -CertStoreLocation Cert:\\LocalMachine\\Root
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-01-31
      • 1970-01-01
      • 1970-01-01
      • 2015-03-23
      • 1970-01-01
      • 2019-07-05
      • 1970-01-01
      相关资源
      最近更新 更多