作为使用C#/ ASP.NET Core学习EF Core的练习,我完成了本教程的最后部分:ASP.NET Core Web API with EF Core Code-First Approach。
完成操作后,我就可以从源文件夹运行'dotnet watch run'
,并加载端点http://localhost:5000/api/employee
,我可以在Chrome中获得响应,从重定向到https://localhost:5001/api/employee
个端点。
我被困是因为我想在邮递员中得到同样的答复,但是我只看到以下内容:
这是我在运行服务器的Powershell中看到的:
PS C:\Users\foo\source\repos\EFCoreCodeFirstSample\EFCoreCodeFirstSample> dotnet watch run
watch : Started
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\C M\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Hosting environment: Development
Content root path: C:\Users\foo\source\repos\EFCoreCodeFirstSample\EFCoreCodeFirstSample
Now listening on: http://localhost:5000
Now listening on: https://localhost:5001
Application started. Press Ctrl+C to shut down.
dbug: HttpsConnectionAdapter[1]
Failed to authenticate HTTPS connection.
System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Security.SslState.ThrowIfExceptional()
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.<AuthenticateAsServerAsync>b__51_1(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Server.Kestrel.Https.Internal.HttpsConnectionAdapter.InnerOnConnectionAsync(ConnectionAdapterContext context)
来自
的所有内容dbug: HttpsConnectionAdapter[1]
Failed to authenticate HTTPS connection
及以下显示当我运行Postman Get请求时。我猜想这与我的startup.cs的配置有关系...但是我不确定从哪里开始。在此处搜索Stack Overflow时,我遇到了很多有关SSL证书和pfx文件的问题,但与该问题没有特别的关系。我对此并不陌生,在学校里,所以也许我只是错过了答案,因为这超出了我的知识范围?我不明白为什么它可以在chrome中使用,但Postman却不行。