简体   繁体   English

ASP.NET Core 6:当使用不同的用户打开 Visual Studio 时,httpclient 调用 API 时出错。 AuthenticationException:远程证书无效

[英]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.

相关问题 .Net Core + Kubernetes > AuthenticationException:远程证书根据验证程序无效 - .Net Core + Kubernettes > AuthenticationException: The remote certificate is invalid according to the validation procedure ASP.Net Core 3 远程证书在 MacOs 上无效 - ASP.Net Core 3 The remote certificate is invalid on MacOs 我无法访问已登录用户的用户名。 (ASP.NET Core Web API) - I can't access the UserName of the logged in user. (ASP.NET Core Web API) 从登录用户获取产品时出错。 ASP.NET 核心MVC - Error getting products from the logged in user. ASP.NET Core MVC HTTPClient error when calling ASP.NET Web API REST service from ASP.NET MVC app - HTTPClient error when calling ASP.NET Web API REST service from ASP.NET MVC app Asp.Net Core MailKit:根据验证过程,远程证书无效 - Asp.Net Core MailKit: The remote certificate is invalid according to the validation proceedure Asp.Net Core WEB API 错误 404 调用方法 - Asp.Net Core WEB API error 404 calling method ASP.NET Core Web API 使用客户端证书调用其他 Web API 获取 401 - ASP.NET Core Web API calling other Web API using Client Certificate getting 401 从Angular HttpClient到ASP.NET Core 2.2 Web API进行POST调用时出现404错误(启用了CORS) - 404 error when making a POST call from Angular HttpClient to ASP.NET Core 2.2 Web API (with CORS enabled) ASP.NET 核心 MVC 调用 API - ASP.NET Core MVC calling an API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM