请帮助我,我最近遇到了这个问题: 我试图从视图生成pdf,但发布后我在服务器端遇到了一些问题
例外:访问被拒绝 控制器:示例 行动:ExampleView
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at Rotativa.WkhtmltopdfDriver.Convert(String wkhtmltopdfPath, String switches, String html)
at Rotativa.AsPdfResultBase.CallTheDriver(ControllerContext context)
at Rotativa.AsPdfResultBase.BuildPdf(ControllerContext context)
at Rotativa.AsPdfResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
我真的不知道发生了什么...... Rotativa版本1.6.1本地工作但在服务器上我收到此错误... 控制器:
namespace ZarzadzaniePortalem.Controllers
{
[Authorize]
public class ExampleController : Controller
{
public ActionResult ExampleView()
{
return new Rotativa.ActionAsPdf("ExampleToPrint")
{
FileName = "ExampleToPrint.pdf"
};
}
[AllowAnonymous]
public ActionResult ExampleToPrint()
{
/* some viewbags */
return View();
}
}
}
答案 0 :(得分:0)
希望您的问题得到解决。如果没有,那么让我发布一个有效的解决方案。
ActionAsPdf()
。ViewAsPdf()