在Asp.net中运行外部可执行文件的内存限制
|
我在.NET 4.0中运行的C#Web应用程序中使用WkhtmltoPdf从 HTML文件生成PDF.通常一切正常,除非HTML文件的大小低于250KB.一旦HTML文件大小超过该值,运行wkhtmltopdf.exe的进程就会产生如下异常.在任务管理器上,我已经看到wkhtmltopdf.exe进程的内存值没有超过40,096 K的值,我相信这就是为什么在这两者之间放弃进程的原因. 我们如何配置外部exes的内存限制可以增加?有没有其他方法可以解决这个问题? 更多信息: 错误来自localhost.我在DEV服务器上尝试过相同的结果. 编辑:
例外: > [Exception: Loading pages (1/6) [> > ] 0% [======> ] > 10% [======> ] 11% > [=======> ] 13% > [=========> ] 15% > [==========> ] 18% > [============> ] 20% > [=============> ] 22% > [==============> ] 24% > [===============> ] 26% > [=================> ] 29% > [==================> ] 31% > [===================> ] 33% > [=====================> ] 35% > [======================> ] 37% > [========================> ] 40% > [=========================> ] 42% > [==========================> ] 44% > [============================> ] 47% > [=============================> ] 49% > [==============================> ] 51% > [============================================================] 100% > Counting pages (2/6) > [============================================================] Object > 1 of 1 Resolving links (4/6) > [============================================================] Object > 1 of 1 Loading headers and footers (5/6) > Printing pages (6/6) [> > ] Preparing [=> > ] Page 1 of 49 [==> > ] Page 2 of 49 [===> > ] Page 3 of 49 [====> > ] Page 4 of 49 [======> > ] Page 5 of 49 [=======> > ] Page 6 of 49 [========> > ] Page 7 of 49 [=========> > ] Page 8 of 49 [==========> > ] Page 9 of 49 [============> > ] Page 10 of 49 [=============> > ] Page 11 of 49 [==============> > ] Page 12 of 49 [===============> > ] Page 13 of 49 [================> > ] Page 14 of 49 [==================> > ] Page 15 of 49 [===================> > ] Page 16 of 49 [====================> > ] Page 17 of 49 [=====================> > ] Page 18 of 49 [======================> > ] Page 19 of 49 [========================> > ] Page 20 of 49 [=========================> > ] Page 21 of 49 [==========================> > ] Page 22 of 49 [===========================> > ] Page 23 of 49 [============================> > ] Page 24 of 49 [==============================> > ] Page 25 of 49 [===============================> > ] Page 26 of 49 [=================================> > ] Page 27 of 49 [==================================> > ] 我使用的代码: var fileName = " - ";
var wkhtmlDir = ConfigurationManager.AppSettings[Constants.AppSettings.ExportToPdfExecutablePath];
var wkhtml = ConfigurationManager.AppSettings[Constants.AppSettings.ExportToPdfExecutablePath] + "wkhtmltopdf.exe";
var p = new Process();
string switches = "";
switches += "--print-media-type ";
switches += "--margin-top 10mm --margin-bottom 10mm --margin-right 5mm --margin-left 5mm ";
switches += "--page-size A4 ";
switches += "--disable-smart-shrinking ";
var startInfo = new ProcessStartInfo
{
CreateNoWindow = true,FileName = wkhtml,Arguments = switches + " " + url + " " + fileName,UseShellExecute = false,RedirectStandardOutput = true,RedirectStandardError = true,RedirectStandardInput=true,WorkingDirectory=wkhtmlDir
};
p.StartInfo = startInfo;
p.Start();
调试器WkHtmlToPdf.exe进程的屏幕截图: 解决方法这就是你要找的:http://jobobjectwrapper.codeplex.com/ 我找不到任何与“增加”进程的内存限制有关的内容,虽然我听说有人用MaxWorkingSet限制进程内存,但我相信这只适用于应用程序使用它之后的虚拟内存能够. Job Object是一个很好的起点,它们只是一组易于控制的流程.
这也许有用: Calling wkhtmltopdf to generate PDF from HTML (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- 验证 – ASP.NET MVC 4避免生成datetime的data-val-date
- 从ASP.NET应用程序写入IIS日志
- asp.net – applicationSettings和Web.config
- asp.net-mvc – Asp.Net MVC主题,如何?
- asp.net – 通过web.config覆盖machine.config
- asp.net-mvc – OwinStartup没有开始…为什么?
- asp.net-mvc – Ajax重定向到页面而不是更新目标
- asp-classic – 经典ASP中的Cookie.HTTPOnly
- ASP.NET;几个会话变量或“容器对象”?
- ASP.Net将用户数据存储在验证Cookie中
- asp.net – 为什么GridView在回发后不会将标题行
- ASP.NET Health Monitoring和ELMAH是否相互替代?
- asp.net – 如何在selectindexchanged下拉列表后
- 在ASP.Net MVC应用程序中放置初始化代码的位置?
- ASP.NET UpdatePanel库引用错误
- asp.net-mvc – ASP.NET MVC身份默认实现
- 压力测试ASP.Net应用程序
- asp.net-mvc-3 – 如何拦截MVC应用程序中的所有控
- asp.net – How2:在HttpModule中挂钩的事件,用于
- asp.net-mvc – 为什么ASP.NET MVC上的控制器基于
