Xamarin C# 错误:SecureChannelFailure(身份验证或解密失败.)

编程入门 行业动态 更新时间:2024-10-27 19:28:25
本文介绍了Xamarin C# 错误:SecureChannelFailure(身份验证或解密失败.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我用这个:

        WebClient mClient = new WebClient();
        mClient.UseDefaultCredentials = false;
        mClient.Credentials = new NetworkCredential("Name", "Password");
        Uri mUrl = new System.Uri("https://server");
        mClient.DownloadDataAsync(mUrl);
        mClient.DownloadDataCompleted += MClient_DownloadDataCompleted;`

我在标题中看到了错误.

and i get the error in the headline.

我不明白的是,如果我在 Visual Studio 的控制台应用程序中使用相同的代码,我会得到预期的结果!但是,如果我在我的 android 应用程序中使用此代码,我会在标题中收到错误消息.我在模拟器和设备上试过了.

What i do not understand is that if i use the same code in a console application in Visual Studio, i get the expected result! But if i use this code in my android app i get the error in the headline. i tried it on the emulator and with a device.

推荐答案

使用 ModernHttpClient 对我不起作用.有效的是更改 Android 项目中的一些设置.首先右键单击项目并选择属性".

Using ModernHttpClient didn't work for me. What did work was changing some settings in the Android project. Start by right clicking on the project and selecting Properties.

Android 选项 > 高级 > HttpClient 实现 = Android

Android Options > Advanced > HttpClient implementation = Android

Android 选项 > 高级 > SSL/TLS 实现 = Native TLS 1.2+

Android Options > Advanced > SSL/TLS implementation = Native TLS 1.2+

我使用的是 Visual Studio 2017.

I'm on Visual Studio 2017.

这篇关于Xamarin C# 错误:SecureChannelFailure(身份验证或解密失败.)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 16:50:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1139272.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:身份验证   错误   Xamarin   SecureChannelFailure

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!