DFB*_*rry 1 c# asp.net certificate client-certificates uwp
我正在接管别人的项目并试图让前端(UWP)与后端(asp.net core 2.x api)对话。
它们独立工作,后端在调试时打开浏览器到正确的路由https://localhost:44319/api/status。当我尝试将前端连接到后端时,我得到The certificate authority is invalid or incorrect
该代码使用 HttpClient。
HttpClient client = new HttpClient(new
HttpClientHandler() { UseDefaultCredentials = true });
var uri = new Uri(string.Format(accountListServiceUri, string.Empty));
var response = await client.GetAsync(uri);
Run Code Online (Sandbox Code Playgroud)
我正在通过 IISExpress 运行后端,并使用以下 powershell 脚本来获取 IIS Express 开发证书的缩略图。
View certificate Copy Set-Location Cert:\LocalMachine\My Get-ChildItem | Format-Table Subject, FriendlyName, Thumbprint
Run Code Online (Sandbox Code Playgroud)
我使用缩略图制作了一个 pfx 文件。
Get-ChildItem -Path cert:\localMachine\my\<THUMBNAIL> | Export-PfxCertificate -FilePath C:\<PROJECTNAME>.pfx -Password $mypwd
Run Code Online (Sandbox Code Playgroud)
然后我根据不同的 SO 答案将 pfx 导入受信任的根证书颁发机构和受信任的人。
我认为服务器设置正确,但客户端没有。我想在不输入 #debug 代码的情况下解决这个问题,因为它不会通过安全检查。
感谢您的任何帮助。
| 归档时间: |
|
| 查看次数: |
671 次 |
| 最近记录: |