[英]ASP.NET Core 6 : httpclient error calling API when open Visual Studio with different User. AuthenticationException: The remote certificate is invalid
I am creating an ASP.NET Core 6 MVC app.我正在创建一个 ASP.NET Core 6 MVC 应用程序。
I have two applications, a client application (ClientUI) that calls an API.我有两个应用程序,一个调用 API 的客户端应用程序 (ClientUI)。
Both applications are running in Visual Studio 2022.这两个应用程序都在 Visual Studio 2022 中运行。
The API is connected to a SQL database, and in order to have access to the database, I have to open Visual Studio as different user and use a user and password generated by BeyondTrust. API 连接到 SQL 数据库,为了访问数据库,我必须以不同的用户身份打开 Visual Studio 并使用 BeyondTrust 生成的用户和密码。
Using those credentials I have access to the database.使用这些凭据我可以访问数据库。
When I do an HttpClient
call from the ClientUI to the API endpoint, I got this error当我从 ClientUI 调用
HttpClient
到 API 端点时,出现此错误
System.AggregateException: 'One or more errors occurred.
System.AggregateException: '发生一个或多个错误。 (The SSL connection could not be established, see inner exception.)'
(无法建立 SSL 连接,请参阅内部异常。)'
AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot
AuthenticationException:由于证书链中的错误,远程证书无效:UntrustedRoot
If a open Visual Studio with my credentials, I have no problem to connect to the endpoint (but is does not connect to the database).如果使用我的凭据打开 Visual Studio,我可以毫无问题地连接到端点(但不会连接到数据库)。
My credentials are up to date.我的凭据是最新的。 Those credentials are not available when I open Visual Studio with different user?
当我用不同的用户打开 Visual Studio 时,这些凭据不可用?
I read what it is said here , but I do not have a directory ASP.NET in this path C:\Users\{User}\AppData\Roaming\ASP.NET\Https
我阅读了这里所说的内容,但我在此路径
C:\Users\{User}\AppData\Roaming\ASP.NET\Https
中没有目录 ASP.NET
The Only solution I found was open both visual studio with the same user/password.我找到的唯一解决方案是使用相同的用户/密码打开两个 visual studio。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.