Select.Pdf:访问安全性关键方法的安全透明方法

时间:2019-02-06 17:16:41

标签: .net pdf-generation

我正在使用Select.Pdf制作我的角度应用程序页面的PDF文件。

Select.Pdf正在.Net.Core 4.6.2的服务器端破坏。

这是进行转换的代码

SelectPdf.HtmlToPdf converter = new SelectPdf.HtmlToPdf();    
SelectPdf.PdfDocument doc = converter.ConvertUrl(url);
return doc.Save();

由于某种原因,ConvertUrl方法以下面列出的异常结束

System.Exception
  HResult=0x80131500
  Message=Conversion failure. Attempt by security transparent method 'SelectPdf.Lib.ស.ᜃ()' to access security critical method 'System.Runtime.InteropServices.Marshal.AllocHGlobal(Int32)' failed.

Assembly 'Select.Pdf, Version=18.4.0.0, Culture=neutral, PublicKeyToken=e0ae9f6e27a97018' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model.  Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
  Source=Select.Pdf
  StackTrace:
   at SelectPdf.HtmlToImage.ᜀ(String A_0, ឨ[]& A_1, ឃ& A_2)
   at SelectPdf.HtmlToPdf.ᜁ(String A_0, String A_1, String A_2, String A_3, Boolean A_4)
   at SelectPdf.HtmlToPdf.ConvertUrl(String url)
   at Powel.UtilityFlow.Portal.HtmlToPdfService.SelectPdfHtmlToPdfService.GeneratePdf(String url) in C:\Projects\Powel.Dynamics365.Portal\Powel.UtilityFlow.Portal\Services\HtmlToPdfService\SelectPdfHtmlToPdfService.cs:line 41
   at Powel.UtilityFlow.Portal.Controllers.EnquiryController.generatePDF(Guid id, String url) in C:\Projects\Powel.Dynamics365.Portal\Powel.UtilityFlow.Portal\Controllers\EnquiryController.cs:line 435
   at Powel.UtilityFlow.Portal.Controllers.EnquiryController.<>c__DisplayClass16_0.<PostNewEnquiry>b__1() in C:\Projects\Powel.Dynamics365.Portal\Powel.UtilityFlow.Portal\Controllers\EnquiryController.cs:line 316
   at System.Threading.Tasks.Task.Execute()

有人知道此异常的根本原因是什么吗?

0 个答案:

没有答案
相关问题