Oktokit.Net无法创建TLS连接

时间:2018-03-07 14:20:44

标签: f# github-api

我写了一个小测试用例来隔离我们得到的github api授权错误。相关代码如下。

let private authToken = "XX REDACTED XX"

let product: Product.ProductInfo =
{
    GitHubProjectOwner = "Weingartner"
    GitHubProjectName = "automation-test"
}


let testAuth owner project =
async {
    let client = GitHubClient(ProductHeaderValue "WeingartnerDistribution")
    client.Credentials <- Credentials authToken 
    let! user = client.User.Current() |> Async.AwaitTask
    return user <> null
}

[<Fact>]
member x.``Should be able to authenticate with github``() =
    async {
        let owner = product.GitHubProjectOwner
        let project = product.GitHubProjectName
        let! client = GitHubIssue.testAuth owner project
        test <@ client @>
    }
    |> Async.StartAsTask

authtoken来自已添加了对存储库的读/写功能的用户,而authtoken仅用于 repo

enter image description here

我得到以下堆栈跟踪

System.AggregateException
One or more errors occurred.
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.TestInvoker`1.<>c__DisplayClass48_1.<<InvokeTestMethodAsync>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.ExecutionTimer.<AggregateAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xunit.Sdk.ExceptionAggregator.<RunAsync>d__9.MoveNext()

System.Net.Http.HttpRequestException
An error occurred while sending the request.
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.Internal.HttpClientAdapter.<SendAsync>d__10.MoveNext() in D:\repos\octokit.net\Octokit\Http\HttpClientAdapter.cs:line 180
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.Internal.HttpClientAdapter.<Send>d__3.MoveNext() in D:\repos\octokit.net\Octokit\Http\HttpClientAdapter.cs:line 47
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.Connection.<RunRequest>d__55.MoveNext() in D:\repos\octokit.net\Octokit\Http\Connection.cs:line 582
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.Connection.<Run>d__54`1.MoveNext() in D:\repos\octokit.net\Octokit\Http\Connection.cs:line 573
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Octokit.ApiConnection.<Get>d__8`1.MoveNext() in D:\repos\octokit.net\Octokit\Http\ApiConnection.cs:line 0

System.Net.WebException
The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)

我很确定一切都是正确的。知道为什么我无法连接吗?错误摘要是

无法创建SSL / TLS安全通道。

0 个答案:

没有答案