Xamarin C# 错误:SecureChannelFailure(身份验证或解密失败.) [英] Xamarin C# Error: SecureChannelFailure (The authentication or decryption has failed.)

查看:49
本文介绍了Xamarin C# 错误:SecureChannelFailure(身份验证或解密失败.)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这个:

        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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆