asp.net-mvc-4 – NReco.PdfGenerator服务器上的管道已经结束错
发布时间:2020-12-16 03:38:24 所属栏目:asp.Net 来源:网络整理
导读:我正在为我的PDF文档使用 NReco.PdfGenerator(该组件基于WkHtmlToPdf工具),我的代码允许我使用参数controller,action,model创建一个调用函数的pdf: public static byte[] GeneratePdfDocument(System.Web.Mvc.Controller controller,string viewName,object
我正在为我的PDF文档使用
NReco.PdfGenerator(该组件基于WkHtmlToPdf工具),我的代码允许我使用参数controller,action,model创建一个调用函数的pdf:
public static byte[] GeneratePdfDocument(System.Web.Mvc.Controller controller,string viewName,object model) { string result; controller.ViewData.Model = model; using (StringWriter sw = new StringWriter()) { ViewEngineResult viewResult = ViewEngines.Engines.FindPartialView(controller.ControllerContext,viewName); ViewContext viewContext = new ViewContext(controller.ControllerContext,viewResult.View,controller.ViewData,controller.TempData,sw); viewResult.View.Render(viewContext,sw); result = sw.ToString(); } return (new NReco.PdfGenerator.HtmlToPdfConverter()).GeneratePdf(result); } 使用此代码,我可以从我的视图中轻松创建PDF,并且它在我的开发环境中运行良好但在服务器上我收到此错误: The pipe has been ended. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.IOException: The pipe has been ended. [IOException: The pipe has been ended.] System.IO.__Error.WinIOError(Int32 errorCode,String maybeFullPath) +11185413 System.IO.FileStream.WriteCore(Byte[] buffer,Int32 offset,Int32 count) +10770013 System.IO.FileStream.Write(Byte[] array,Int32 count) +139 NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdfInternal(String htmlFilePath,Byte[] inputBytes,String coverHtml,String outputPdfFilePath,Stream outputStream) +2166 [Exception: Cannot generate PDF: The pipe has been ended.] NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdfInternal(String htmlFilePath,Stream outputStream) +2734 NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdf(String htmlContent,Stream output) +51 NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdf(String htmlContent,String coverHtml) +42 我认为这可能是我的IIS上的权限或某些配置的问题,任何想法? 解决方法
您可能缺少VS2013(x86)的Visual C Redistributable Packages.即使您的服务器运行的是64位Windows,也需要安装x86 C软件包.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc-4 – 如何设置DropDownFor的id和类 – asp.net
- 使用ASP.net(Vb.net)将上载的Excel文档中的数据插入数据库
- WPF 增加合计一栏
- asp.net-web-api – 请求的资源不支持http方法“PUT”
- asp.net – web.config中的元素和项目文件之间有什么不同
- asp.net-mvc – 为什么Asp.net MVC4不能使用SQL Server会话
- entity-framework – ViewModels和MVC中Entity Framework的
- asp.net+jquery ajax无刷新登录的实现方法
- Asp.Net中ajax+aspx使用详解
- asp.net-mvc – ServiceStack和MVC4没有连线
推荐文章
站长推荐
- asp.net-mvc – NuGet项目>添加库包参考未出现
- 如何设置asp.net下拉列表的样式
- asp-classic – 从头开始??在Visual Studio 2010
- asp.net – 如果我只是在做一个查找表,我应该使用
- asp.net-mvc-3 – 实体框架|代码优先|从CultureI
- asp.net – 如何在Windows Phone中开发Google地图
- asp.net-mvc – Orchard CMS:未显示内容部分
- asp.net-mvc – 用于枚举的IRouteConstraint
- asp.net – 获取Gridview中隐藏列的值
- asp.net-mvc – 使用Asp.net Mvc缩略图
热点阅读