[英]How to get Abcpdf to render content over SSL with Self Signed Certificate
我們的Dev / QA環境使用自簽名的ssl證書,我們正在試用Abcpdf將html轉換為pdf,但是呈現html的站點在自簽名的SSL證書下運行。
Doc theDoc = new Doc();
theDoc.AddImageUrl("https://mysite/Test");
theDoc.Save(@"c:\tmp\htmlimport.pdf");
theDoc.Clear();
結果是
WebSupergoo.ABCpdf9.Internal.PDFException : Unable to render HTML. Unable to access URL. COM error 800c0019. Security certificate required to access this resource is invalid.
TimeStampServiceUrl的手冊狀態:
ABCpdf使用System.Net.WebRequest發送時間戳請求。 連接到SSL / TLS通道時,可以使用System.Net.ServicePointManager.ServerCertificateValidationCallback定制信任關系的建立。
但是對於AddImageUrl()沒有任何相似之處,無論如何我都嘗試過,並且永遠不會觸發回調:
public class PdfTester
{
public void Test()
{
ServicePointManager.ServerCertificateValidationCallback = ServerCertificateValidation;
Doc theDoc = new Doc();
theDoc.AddImageUrl("https://mysite/Test");
theDoc.Save(@"c:\tmp\htmlimport.pdf");
theDoc.Clear();
}
private static bool ServerCertificateValidation(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
}
}
有什么想法在這種情況下如何繞過此驗證?
嘗試通過提琴手運行它,您可能會遇到由http://support.microsoft.com/kb/2677070引起的此問題
此問題的症狀使您專注於目標URL,但是該KB文章中列出的Windows更新URL可能有多個子請求,以及證書中對URL的請求。 我們遇到了這個問題,小提琴手能夠一路暴露502錯誤,最終導致800C0019錯誤。
我們通過將提琴手公開的所有URL添加到客戶的例外列表中來解決此問題,但是Microsoft 此處提供了修復程序。
當然,這只是可能的解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.