日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【转】D365 FO第三方访问https证书问题

發布時間:2023/12/10 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【转】D365 FO第三方访问https证书问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

D365FO采用https,第三方通過API調用的時候,客戶端不見得信任D365FO的證書,調用時候會報
基礎連接已關閉,發送時發生錯誤,調用堆棧如下:

?

1 at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)2 at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)3 at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)4 at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)5 at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)6 at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)7 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)8 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)9 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 10 at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result) 11 at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size) 12 at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size) 13 at System.Net.ConnectStream.WriteHeaders(Boolean async)

?

從調用堆棧看,應該是跟SSL驗證有關系。
當然有時候還會直接報
基礎連接已經關閉: 未能為 SSL/TLS 安全通道建立信任關系
這個就更直接了。
網上有很多解決辦法,目的是讓https請求跳過客戶端對SSL證書的驗證。

?

1 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; 2 ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback( 3 (object caller, 4 X509Certificate certifacate, 5 X509Chain chain, 6 SslPolicyErrors erros) => { return true; }); 7 var request = HttpWebRequest.Create(url);

?

這段代碼一定要放到HttpWebRequest之前,要不然回調的時候調不到方法。
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
這一句也是必須的,D365的協議版本是Tls12,指定別的版本也不會跳過檢查。

總結

以上是生活随笔為你收集整理的【转】D365 FO第三方访问https证书问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。