如果我使用 http URI,下面的代码对我来说效果很好,但对于等效的 https 替代方案则失败。当在另一台机器上构建和运行或者当我将它包含在另一个应用程序中时,它工作得很好。
GetStringAsync 引发异常:“在 .exe 中的 0x770B5722 (KernelBase.dll) 处引发异常:0x000006F4:将空引用指针传递给 stub 。发生了”。
ThreadPool::RunAsync(ref new WorkItemHandler([this](IAsyncAction^ action)
{
HttpClient^ client = ref new HttpClient();
auto uri = ref new Uri(L"https://....");
auto t = create_task(client->GetStringAsync(uri));
t.then([](String^ response)
{
// response should be valid.
});
}));
最佳答案
运行 netsh Winsock Reset
来重置网络堆栈似乎可以解决该问题!
关于https - HttpClient->GetStringAsync() 对于 https Uris 抛出 0x000006F4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43902100/