在 MacBook Pro El Capitan 10.11.12 i5 上为 ASP.net app dev 设置 Mono:tlstest.cs 编译有 3 个警告,tlstest.exe 编译有 1 个错误
正在尝试运行此处列出的测试:
http://www.mono-project.com/docs/getting-started/mono-basics/
mono hello.exe //runs fine with no errors and prints "Hello Mono World"
但是,我下载了 tlstest.cs(请参阅上面的链接获取源代码)并使用以下代码编译它:
mcs tlstest.cs /r:System.dll /r:Mono.Security.dll
这返回了 3 个警告,如下所示:
tlstest.cs(169,23):警告 CS0618:System.Net.ServicePointManager.CertificatePolicy' 已过时:
改用 ServerCertificateValidationCallback'
tlstest.cs(210,26):警告 CS0618:System.Net.Dns.Resolve(string)' 已过时:
改用 GetHostEntry'
tlstest.cs(176,11):警告 CS0219:已分配变量“prefix”但从未使用其值
编译成功 - 3 个警告
现在 tlstest.exe 已经创建,所以我运行:
mono tlstest.exe https://www.nuget.org //which returned an error:
错误 #-2146762486:CERT_E_CHAINING 0x800B010A
最佳答案
有同样的错误“错误#-2146762486:CERT_E_CHAINING 0x800B010A”。按照链接“mono-project.com/docs/faq/security”建议的常见问题解答进行操作。 感谢乔纳森·詹姆斯
执行命令
"mozroots --import --ask-remove --machine"
显示以下结果:
Mozilla Roots Importer - version 5.14.0.0 Download and import trusted root certificates from Mozilla's MXR. Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.
WARNING: mozroots is deprecated, please move to cert-sync instead.
Downloading from 'https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt'... WARNING: Downloading the trusted certificate list couldn't be done securely (error: RemoteCertificateChainErrors)
无论如何继续。
如果您使用 mozroots 在干净的系统上引导 Mono 的信任库,这可能没问题,否则它可能表明存在网络入侵。请确保您使用的是受信任的网络或转向证书同步。
Importing certificates into machine store. 150 new root certificates were added to your trust store. Import process completed.
然后再次执行以下步骤:
csc tlstest.cs -r:System.dll <-- 2 warning as before
单声道 tlstest.exe https://www.nuget.org <--未显示错误,仅显示“https://www.nuget.org”。 希望这有助于...
关于c# - 单声道 tlstest.exe 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34404079/