在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中的TDD新手,我是否在正确的轨道上编写测试?
- asp.net – “<%:”做什么?
- asp.net-mvc-5 – 如何在没有数据库的情况下使用ASP.NET Id
- asp.net-mvc – 具有DateTime的MVC 3编辑器模板
- ASP.NET会员密码重置
- 使用MVC在ASP.NET中实现API的最佳方法是什么?
- asp.net – 有没有办法每天在.Net Web应用程序中运行一个进
- asp.net-mvc – 我应该将.edmx和生成的POCO类放在哪一层?
- asp.net-mvc – 我想使用web.config中的规则在localhost po
- asp.net – 请求验证 – 在SiteCore中如何以及为什么禁用它
- ASP.NET GridView利用PagerTemplate自定义分页
- asp.net – 对于在共享模型上运行的Azure网站,“
- 使用dotnet-buildpack将ASP.NET 5应用程序部署到
- asp.net-web-api – JwtSecurityTokenHandler 4.
- dependency-injection – asp.net 5依赖注入拦截
- asp.net-core – 在ASP.NET Core中使用Entity Fr
- 使用母版页在ASP.NET应用程序上切换语言
- asp.net – 使用Eval连接文本
- asp.net – 是否可以将.ASPXAUTH用于我自己的日志
- asp.net-mvc – ASP.NET身份和声明