【问题标题】:System.Security.SecurityException: Pechkin html to pdf generator throws security exception on shared hostingSystem.Security.SecurityException:Pechkin html 到 pdf 生成器在共享主机上引发安全异常
【发布时间】:2014-05-11 17:31:49
【问题描述】:

我正在使用 Pechkin HTMLPDF 生成器。 它在本地服务器上运行良好,但在共享托管公司上抛出异常。

https://github.com/tuespetre/Pechkin

安全例外:

描述:应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请联系您的系统管理员或在配置文件中更改应用程序的信任级别。

异常详细信息:System.Security.SecurityException:请求失败。

[SecurityException: Request failed.]
   Pechkin.Factory.Create(GlobalConfig config) +0
   client_GenerateReport2.Button5_Click(Object sender, EventArgs e) +270
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6704
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245
   System.Web.UI.Page.ProcessRequest() +72

谁能解释我做错了什么?

【问题讨论】:

  • security 标签的用途与您在此处的用途不同。它适用于如何保护程序或一段代码的更一般的应用程序,而不适用于您遇到的错误,这些错误恰好包含安全一词。

标签: .net pdf shared-hosting pechkin


【解决方案1】:

这是一个安全问题。 Pechkin 不能在中等信任下工作,这是大多数共享主机默认设置的

https://github.com/gmanny/Pechkin/issues/55

只需尝试在本地机器上设置中等信任,你就会得到同样的错误。

<system.web>
    <trust level="Medium" />
</system.web>

经过研究,我找到了一个库 www.sautinsoft.com,它在中等信任级别上工作以生成 html 到 pdf。

【讨论】:

    猜你喜欢
    • 2011-09-04
    • 1970-01-01
    • 1970-01-01
    • 2011-03-28
    • 2013-01-15
    • 1970-01-01
    • 1970-01-01
    • 2017-04-20
    • 2011-04-12
    相关资源
    最近更新 更多