我编写了一个POC,它将来自.nety应用程序的SNS消息发送到AWS SNS。 安装在我的Win 7笔记本电脑上时工作正常。但是,当我在Windows Server 2008上安装它时,它会给我这个错误消息。
我很确定代码很好,因为它适用于笔记本电脑安装。 这是错误,
11/28/2017 8:20:34 PM:
A WebException with status SecureChannelFailure was thrown.
11/28/2017 8:20:34 PM:
at Amazon.Runtime.Internal.WebExceptionHandler.HandleException(IExecutionContext executionContext, WebException exception)
at Amazon.Runtime.Internal.ExceptionHandler`1.Handle(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.ProcessException(IExecutionContext executionContext, Exception exception)
at Amazon.Runtime.Internal.ErrorHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.Signer.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CredentialsRetriever.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RetryHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.EndpointResolver.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.Marshaller.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.CallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.PipelineHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.MetricsHandler.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.Internal.RuntimePipeline.InvokeSync(IExecutionContext executionContext)
at Amazon.Runtime.AmazonServiceClient.Invoke[TRequest,TResponse](TRequest request, IMarshaller`2 marshaller, ResponseUnmarshaller unmarshaller)
at Amazon.SecurityToken.AmazonSecurityTokenServiceClient.AssumeRole(AssumeRoleRequest request)
答案 0 :(得分:0)
自己想出这个。 所以我的.NET应用程序使用的框架3.5不支持TLS 1.2。 我将我的项目迁移到.NET 4.5并添加了一行以确保我们始终使用TLS 1.2,因为这是在狮子狗攻击之后的事实标准。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
这解决了我的问题。 大多数情况下,此错误必须与您的运行时或系统的安全配置相关。