问题描述
我正在尝试使用 SSL 证书调用网页,如下所示:
public string GetToken()
{
using (var httpclienthandler = new httpclienthandler())
{
httpclienthandler.ServerCertificateCustomValidationCallback = (message,cert,chain,errors) => { return true; };
httpclienthandler.SslProtocols = System.Security.Authentication.SslProtocols.Tls;
using (var httpClient = new HttpClient(httpclienthandler))
{
HttpResponseMessage response = httpClient.GetAsync("https://pgsb.iran.gov.ir").Result;
return "ok";
}
}
}
当我在 .NETCore 3.1 中调用我的控制器时,我收到此错误。
@L_502_0@
当我使用 POSTMAN 调用网站时返回成功响应但是当我使用 IIS 托管的 .NETCORE 调用网站时,我收到上述错误。
当我使用 Angular 调用网站时,我想添加一个细节,我在控制台窗口中收到此错误:
no 'access-control-allow-origin' header is present on the requested resource.
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)