当我尝试转换小的.xls文件(30-200kb)时,一切正常,但是当我尝试转换大的.xls文件(50mb)时,我有一个问题。
这是我的代码:
string filePathDoc = "C:\\Users\\vgocov\\Desktop\\testPDF\\freelimits_20140107.xls";
string filePathPdf = "C:\\Users\\vgocov\\Desktop\\testPDF\\freelimits_20140107.pdf";
HtmlToPdfOptions options = new HtmlToPdfOptions();
options.PageSize = EO.Pdf.PdfPageSizes.A4;
HtmlToPdf.ConvertHtml(File.ReadAllText(filePathDoc, filePathPdf, options); 例外情况是:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.发布于 2014-01-09 22:35:12
原因可能是您在计算机上的用户帐户没有足够的访问权限来执行此操作,或者文件设置为ReadOnly。在本地主机上,您可能正在使用管理员帐户,而在生产/实时服务器中则不是这样。
检查以下链接,看看是否有可能对您有所帮助:
http://social.msdn.microsoft.com/Forums/en-US/8789ea67-fbc5-4a7b-a4eb-d4a8a050d5c1/attempt-to-read-or-write-protected-memory-this-is-often-an-indicating-that-other-memory-is-corrupt
http://social.msdn.microsoft.com/Forums/vstudio/en-US/4f48c152-68cd-45ec-a11e-baa7de7f79c3/attempted-to-read-or-write-protected-memory?forum=csharpgeneral
System.AccessViolationException: Attempted to read or write protected memory
https://stackoverflow.com/questions/21022588
复制相似问题