centos下无法 asp.net core无法请求https怎么办?

黑子大哥 中软服务国际有限公司 程序员  2019-05-01 09:22:51
以前都是玩window,最近asp.netcore很火,于是使用了,部署在centos7.2的时候出现了各种各样的坑
其中之一就是无法请求https的坑,网上找了一大堆资料,都不能解决,请问大侠们,如何解决这个bug???

主要是请求HTTPS,http没事,这个错误大概就是说证书问题吧,但是那里找证书呢??
错误:The SSL connection could not be established, see inner exception

代码:


try
{
var html = string.Empty;
HttpClientHandler httpclientHandler = new HttpClientHandler();
httpclientHandler.ServerCertificateCustomValidationCallback = (msg, cert, chain, error) => true;
using (HttpClient client = new HttpClient(httpclientHandler))
{
html = client.GetStringAsync(url).GetAwaiter().GetResult();
}
}
catch (Exception ex)
{
//下载源码出现错误
_log.Error(this, $"生成HTML请求{url}", ex);
}

如果我在运行文件设置:
{
"runtimeOptions": {
"tfm": "netcoreapp2.2",
"framework": {
"name": "Microsoft.AspNetCore.App",
"version": "2.2.1"
},
"configProperties": {
"System.GC.Server": true,
"System.Net.Http.useSocketsHttpHandler": false
}
}
}


不报错误了,但是会出现获取源码结果为空的

到底怎么解决啊?
...全文
1057 1 收藏 11
写回复
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
黑子大哥 2019-06-23
引用 10 楼 秋的红果实 的回复:
看你有几个帖子了,镜像是怎么生成的,运行时端口映射成功没?
还有,你是windows下的docker还是centos下


不知道是我没有表述清楚还是怎么怎么的,我有几个帖子在询问docker怎么用,那是刚入门,要去了解嘛,我docker镜像端口映射不成功愿意是我撞了nginx,默认是80了,
后面,centos部署成功了,docker也部署成功了,能访问了,程序也正常使用,不能正常的是一项功能不能正常使用,就是采集功能

我是程序内部又一段代码,代码用httpclient请求别人的地址,比如请求 https://www.baidu.com,请求别人的 网址的时候,失败,报错说SSL证书问题,但是我不知道怎么解决这个问题,所以发的帖子询问为什么?现在整得我很无奈,解决不了,于是我只得再次部署在window上
回复
秋的红果实 2019-05-09
看你有几个帖子了,镜像是怎么生成的,运行时端口映射成功没? 还有,你是windows下的docker还是centos下
回复
黑子大哥 2019-05-09
引用 8 楼 秋的红果实 的回复:
在startup里,configue方法里面,添加下列代码

app.UseStaticFiles();

就可以访问了
     app.AddStaticFiles(new HTHCMS.Web.Mvc.Entity.StaticFileDirectory("upload", CommonServiceCollectionExtensions.DefaultMines),
                 new HTHCMS.Web.Mvc.Entity.StaticFileDirectory("wwwroot", CMSGlobalConfig.RequestAssetPath, null));
 public static void AddStaticFiles(this IApplicationBuilder app, params StaticFileDirectory[] filedir)
        {
            //默认wwwroot 支持
            app.UseStaticFiles();

            foreach (var dir in filedir)
            {
                var upload_path = Path.Combine(Directory.GetCurrentDirectory(), dir.Path);
                Console.WriteLine(string.Format("建立静态目录 {0}", upload_path));
                if (!Directory.Exists(upload_path))
                {
                    Directory.CreateDirectory(upload_path);
                    Console.WriteLine(string.Format("建立静态目录 {0} 完成", upload_path));
                }
                else
                {
                    Console.WriteLine(string.Format("建立静态目录 {0} 存在.", upload_path));
                }
                app.UseStaticFiles(new StaticFileOptions()
                {
                    FileProvider = new PhysicalFileProvider(upload_path),
                    RequestPath = string.IsNullOrWhiteSpace(dir.RPath) ? new PathString() : new PathString(string.Format("/{0}", dir.RPath)),
                    ContentTypeProvider = dir.Mines != null && dir.Mines.Count > 0 ? new FileExtensionContentTypeProvider(dir.Mines) : new FileExtensionContentTypeProvider()
                    //ServeUnknownFileTypes = true
                });
            }

            //添加一个statics默认根目录路径去访问
            app.AddStaticRoot(CMSGlobalConst.StaticDirInfo);

            Console.WriteLine("建立所有静态目录完毕...");
        }
使用过了,在window下正常访问,在centos下也正常访问,在docker下就不行了,哎!!!
回复
秋的红果实 2019-05-09
在startup里,configue方法里面,添加下列代码

app.UseStaticFiles();

就可以访问了
回复
黑子大哥 2019-05-08
引用 6 楼 程序员的键盘 的回复:
[quote=引用 5 楼 黑子大哥 的回复:] [quote=引用 3 楼 程序员的键盘 的回复:] 尝试一下设协议?

//请求前设置一下使用的安全协议类型 System.Net
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)){
    ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) =>
    {
       return true; //总是接受  
    });
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
}
尝试过了,还是一样的错误
生成HTML请求XXXXXXX/vod/68416.html
System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   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.EndAuthenticateAsClient(IAsyncResult asyncResult)
   at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_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 System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
   at HTHCMS.Web.Mvc.Statics.StaticsFileManager.ToCreate(String url) in E:\project\core\bs\hthcms3.0\01.Mvc\HTHCMS.Web.Mvc\Static\StaticsFileManager.cs:line 391
代码这么写?

            try
            {
                var html = string.Empty;
                //if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
                //{
                ServicePointManager.ServerCertificateValidationCallback =
                    new RemoteCertificateValidationCallback(
                        (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) =>
                {
                    return true; //总是接受  
                    });
                ServicePointManager.SecurityProtocol =
                    SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
                //}
                using (HttpClient client = new HttpClient())
                {
                    client.DefaultRequestHeaders.Add("_create_html", "1");
                    html = client.GetStringAsync(url).GetAwaiter().GetResult();
                }
            }
            catch (Exception ex)
            {
                //下载源码出现错误
                _log.Error(this, $"生成HTML", ex);
            }
没用呢[/quote] 你这错误翻译是证书无效啊 无法建立SSL连接,请参阅内部异常。 ---> System.Security.Authentication.AuthenticationException:根据验证程序,远程证书无效[/quote] 对啊,证书问题,这个证书怎么搞??? 搞不懂了,我将其换成docker部署,访问https的问题解决了,但是他妈的,wwwroot这种静态目录又不能访问了,哎,真的是一个又一个的坑
回复
引用 5 楼 黑子大哥 的回复:
[quote=引用 3 楼 程序员的键盘 的回复:]
尝试一下设协议?

//请求前设置一下使用的安全协议类型 System.Net
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)){
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) =>
{
return true; //总是接受
});
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
}


尝试过了,还是一样的错误
生成HTML请求XXXXXXX/vod/68416.html
System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
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.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_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 System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
at HTHCMS.Web.Mvc.Statics.StaticsFileManager.ToCreate(String url) in E:\project\core\bs\hthcms3.0\01.Mvc\HTHCMS.Web.Mvc\Static\StaticsFileManager.cs:line 391


代码这么写?

try
{
var html = string.Empty;
//if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
//{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(
(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) =>
{
return true; //总是接受
});
ServicePointManager.SecurityProtocol =
SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
//}
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("_create_html", "1");
html = client.GetStringAsync(url).GetAwaiter().GetResult();
}
}
catch (Exception ex)
{
//下载源码出现错误
_log.Error(this, $"生成HTML", ex);
}


没用呢[/quote]


你这错误翻译是证书无效啊
无法建立SSL连接,请参阅内部异常。 ---> System.Security.Authentication.AuthenticationException:根据验证程序,远程证书无效
回复
黑子大哥 2019-05-04
引用 3 楼 程序员的键盘 的回复:
尝试一下设协议?

//请求前设置一下使用的安全协议类型 System.Net
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)){
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) =>
{
return true; //总是接受
});
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
}


尝试过了,还是一样的错误
生成HTML请求XXXXXXX/vod/68416.html
System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
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.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.<AuthenticateAsClientAsync>b__47_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 System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Stream stream, SslClientAuthenticationOptions sslOptions, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at System.Net.Http.HttpClient.GetStringAsyncCore(Task`1 getTask)
at HTHCMS.Web.Mvc.Statics.StaticsFileManager.ToCreate(String url) in E:\project\core\bs\hthcms3.0\01.Mvc\HTHCMS.Web.Mvc\Static\StaticsFileManager.cs:line 391


代码这么写?

try
{
var html = string.Empty;
//if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
//{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(
(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) =>
{
return true; //总是接受
});
ServicePointManager.SecurityProtocol =
SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
//}
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Add("_create_html", "1");
html = client.GetStringAsync(url).GetAwaiter().GetResult();
}
}
catch (Exception ex)
{
//下载源码出现错误
_log.Error(this, $"生成HTML", ex);
}


没用呢
回复
黑子大哥 2019-05-04
引用 2 楼 秋的红果实 的回复:
版本弄对没,
yum install dotnet-sdk-2.X

还要更新
yum update


版本肯定是OK的,其他的功能OK,就两个功能不能用,一个是HTTPS会失败。http正常,第二个是QRCode不报错,这是生成的流是空的,一直无法解决这两个bug,头疼
回复
秋的红果实 2019-05-02
版本弄对没, yum install dotnet-sdk-2.X 还要更新 yum update
回复
尝试一下设协议?

//请求前设置一下使用的安全协议类型 System.Net
if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)){
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) =>
{
return true; //总是接受
});
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
}
回复
黑子大哥 2019-05-01
难不成券CSDN都没人遇到过么?这算高深问题么?
回复
相关推荐
发帖
.NET技术社区
创建于2007-09-28

5.8w+

社区成员

.NET技术交流专区
申请成为版主
帖子事件
创建了帖子
2019-05-01 09:22
社区公告
暂无公告