我遇到了使用 TuesPechkin 将 html 转换为 pdf 的问题。我在 IIS 上有两个应用程序,两个应用程序都有不同的应用程序池。
但我从其中之一得到一个错误:
Unable to load DLL 'wkhtmltox.dll': Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Stack trace
Server stack trace:
at TuesPechkin.WkhtmltoxBindings.wkhtmltopdf_init(Int32 useGraphics)
at TuesPechkin.PdfToolset.Load(IDeployment deployment)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at TuesPechkin.ThreadSafeConverter.Invoke[TResult](FuncShim`1 delegate)
at Codaxy.WkHtmlToPdf.PdfConvert.ConvertHtmlToPdf(List`1 documentlist)
at ArastirmaYonetim.Controllers.RaporController.HtmlRaporOnizle(ArastirmaRaporAramaKriter raporAramaKriter)
但其他应用程序正常工作。
web config的系统web部分,我使用.net framework 4.7.2
<system.web>
<globalization uiCulture="tr" culture="tr-TR" />
<compilation debug="true" targetFramework="4.7.2" >
<assemblies>
<add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
</assemblies>
</compilation>
<httpRuntime maxRequestLength="2147483647" executionTimeout="3600" />
<httpModules>
<add name="TelemetryCorrelationHttpModule" type="Microsoft.AspNet.TelemetryCorrelation.TelemetryCorrelationHttpModule, Microsoft.AspNet.TelemetryCorrelation" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>