【问题标题】:jsreport - Access is denied message in C#jsreport - C# 中的访问被拒绝消息
【发布时间】:2019-12-15 20:22:37
【问题描述】:

我在执行此代码时收到Access Denied 消息:

var report = await _service.RenderAsync(new RenderRequest
{
     Template = new Template
     {
         Recipe = Recipe.PhantomPdf,
         Engine = Engine.None,
         Content = html,
         Phantom = new Phantom()
         {
             Header = header,
             Footer = footer,
             HeaderHeight = GetElementHeightOrDefault(header),
             FooterHeight = GetElementHeightOrDefault(footer)
         }
      }
 });

实际上它在执行_service.RenderAsync 方法时失败了,这是一个从IRenderService 实现的服务。

这是错误信息:

   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at jsreport.Local.Internal.BinaryProcess.<InnerExecute>d__18.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at jsreport.Local.Internal.BinaryProcess.<ExecuteExe>d__17.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at jsreport.Local.Internal.LocalUtilityReportingService.<RenderAsync>d__10.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

我从jsreport 找到了这个帖子,其中有人和我有同样的问题:formu.jsreport.net/topic/428

所以我按照以下步骤操作:

  1. 由于我在 IIS 中有一个 Web 应用程序和一个 IIS Api 服务,因此我将 IUSR 和 IIS_IUSRS 都添加到了应用程序中,并赋予了它们最高权限
  2. 确保我的解决方案是在管理员权限下执行的
  3. 禁用所有防病毒和 Windows 安全

但是这些都没有奏效。我在这里仍然面临同样的问题。

有人可以帮我吗?

【问题讨论】:

  • 您能否尝试将 AppPool 中的模拟更改为管理员用户:IIS > 应用程序池 > 高级设置 > 身份(并将其更改为管理员帐户)
  • 我不得不将其更改为 LocalSystem 身份。不知道为什么,但它奏效了。我希望它在 ApplicationPoolIdentity 下工作......但你能分享你的问题作为答案吗?它驱使我找到解决方案。

标签: c# asp.net .net iis jsreport


【解决方案1】:

可能与模拟有关,因此如果代码未在特定模拟上下文下执行并且所有代码都通过 IIS 模拟运行,那么我们可能需要对 AppPool 进行一些跟踪:

  1. 尝试将 AppPool 中的模拟更改为管理员用户:

IIS > 应用程序池 > 高级设置 > 身份(并更改它 到管理员帐户)。

  1. 给包含渲染内容的目录一个everyone 许可。

另外,根据您的评论,本地系统具有最高权限,而网络服务或 ApplicationPoolIdentity 具有执行应用程序的最低权限,因此本地系统可以解决大部分模拟问题。

【讨论】:

    猜你喜欢
    • 2012-11-05
    • 2012-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-05
    • 2017-10-31
    • 2021-09-18
    相关资源
    最近更新 更多