请帮帮我我最近遇到了这个问题:我试图从视图中生成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();
}
}
}