本文介绍了解密操作失败,请参阅内部异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2017和.NET Core 2.x.我已经建立了两个项目。第一个是后端API()。第二个是前端网站()。前端网站调用后端API。它们都在我的机器上本地运行。

I am using Visual Studio 2017 and .NET Core 2.x. I have set up two projects. The first is the backend API (https://localhost:51637). The second is the front end website (https://localhost:54146). The front end website calls the back end API. They are both running locally on my machine.

问题是,当前端尝试向API发送请求时,我得到了这个证据

Problem is, when the front end tries to send a request to the API, I get this exeption

info: Microsoft.AspNetCore.Server.Kestrel[20]
    Connection id "0HLKNTHFLCEA9" request processing ended abnormally.
System.IO.IOException: The decryption operation failed, see inner exception. ---> System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate
    --- End of inner exception stack trace ---
    at System.Net.Security.SslStreamInternal.ReadAsyncInternal[TReadAdapter](TReadAdapter adapter, Memory`1 buffer)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal.AdaptedPipeline.ReadInputAsync(Stream stream)
    at System.IO.Pipelines.PipeCompletion.ThrowLatchedException()
    at System.IO.Pipelines.Pipe.GetReadResult(ReadResult& result)
    at System.IO.Pipelines.Pipe.ReadAsync(CancellationToken token)
    at System.IO.Pipelines.Pipe.DefaultPipeReader.ReadAsync(CancellationToken cancellationToken)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1Connection.BeginRead(ValueTask`1& awaitable)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
    at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequestsAsync[TContext](IHttpApplication`1 application)


推荐答案

正在开发的两个.NET Core应用程序(其中.NET应用程序是您的自托管网站或API,而另一个是.NET客户端控制台应用程序或其他应用程序)之间也可能发生此错误。

This arcane error may also occur between two .NET Core applications under development where .NET app is your self-hosted website or API and the other is a .NET client console app or whatever.

服务器端错误与上述OP转储相同,客户端错误为:

The server-side error is as per OP dump above, and the client-side error is:

运行它来信任开发证书并解决问题。

Run this to trust the development certificate and resolve the problem.

dotnet dev-certs https -t -v

此处有更多信息。

这篇关于解密操作失败,请参阅内部异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 04:24