首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >X509CertificateValidationMode不能在Linux下工作吗?

X509CertificateValidationMode不能在Linux下工作吗?
EN

Stack Overflow用户
提问于 2017-01-21 08:14:50
回答 1查看 586关注 0票数 0

我有一个用Ubuntu编写的服务,它在.NET上运行得很好,但当我在Ubuntu或官方docker镜像上运行它时,由于问题末尾包含的异常而无法运行。在所有平台上的所有情况下都使用‘`dotnet Asgard.Ihc.Api.dll’。我到处都在使用1.1.0版本。

我的代码是一个WCF客户端,它使用无效的证书调用遗留的SOAP/XML服务。为了解决这个问题,我补充道:

代码语言:javascript
复制
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication()
    {
        CertificateValidationMode = X509CertificateValidationMode.None,
        RevocationMode = X509RevocationMode.NoCheck
    };

然而,从异常情况来看,我最好的猜测是上面的代码不能在Linux上运行。

有人能证实或否认我的怀疑吗?

我还能不能绕过它?(我可以将证书添加到docker容器或主机吗?)

代码语言:javascript
复制
Unhandled Exception: System.AggregateException: One or more errors occurred.
(An error occurred while sending the request.) ---> 
System.ServiceModel.CommunicationException: An error occurred while sending the request. ---> 
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> 
System.Net.Http.CurlException: SSL connect error
at System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode error)
at System.Net.Http.CurlHandler.MultiAgent.FinishRequest(StrongToWeakReference`1 easyWrapper, CURLcode messageResult)
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.ServiceModel.Channels.ServiceModelHttpMessageHandler.<SendAsync>d__37.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Net.Http.HttpClient.<FinishSendAsync>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpClientRequestChannel.HttpClientChannelAsyncRequest.<SendRequestAsync>d__13.MoveNext()
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Asgard.Ihc.Controller.IhcController.<Connect>d__15.MoveNext() in /home/tvl/Asgard.Ihc.Api/src/Asgard.Ihc.Controller/IhcController.cs:line 72
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Asgard.Ihc.Api.IhcMonitor.Start() in /home/tvl/Asgard.Ihc.Api/src/Asgard.Ihc.Api/IhcMonitor.cs:line 23
at Asgard.Ihc.Api.Program.Main(String[] args) in /home/tvl/Asgard.Ihc.Api/src/Asgard.Ihc.Api/Program.cs:line 18
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-02 04:20:49

该错误与.NET核心不允许使用SSL (支持TLS)有关。

对于遗留互操作,我在这里提出了一个问题

https://github.com/dotnet/wcf/issues/1749

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41774381

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档