I am using "SelectPdf Html To Pdf Converter for .NET – Community Edition" to generate pdf files. Everything is working fine on the Live server. Suddenly error start to come when I try to generate pdf files.
If I restart my server it works fine for some time but after some time error starts appearing again.
I am using the latest version of the library. Following is the complete detail of the error
Could not get conversion result header. Data transfer error. Data transmission error 109
Error Detail
System.Exception
Could not get conversion result header. Data transfer error. Data transmission error 109System.Exception: Could not get conversion result header. Data transfer error. Data transmission error 109
at SelectPdf.HtmlToImage.ᜀ(String A_0, String A_1, String A_2, []& A_3, ᣰ& A_4)
at SelectPdf.HtmlToPdf.ᜁ(String A_0, String A_1, String A_2, String A_3, Boolean A_4)
at SelectPdf.HtmlToPdf.ConvertHtmlString(String htmlString, String baseUrl)
at BusinessLogic.SalaryManager.ConvertToPDF(SalarySlipExtra salarySlip, String title, String template, String baseUrl)
at BusinessLogic.SalaryManager.PrintSlips(List1 Ids, String baseUrl)
1 ids, Boolean isPrint)
at SchoolMS.Web.Controllers.api.Manage.ApproveSalaryController.Post(List
This error code merely indicates that the expected response wasn't received. It strongly suggests that an error on the server prevented the server from completing PDF creation properly.
In your case, things work for awhile and then fail, so you might be running out of some server resource that's required for PDF creation. Look at the server event logs and enable application logging, and you may see warnings or error messages that will point you in the right direction.
If you have a reproducible failure scenario, you can attach a debugger to your program on the server and watch it fail in detail.
You can use sysinternals processExplorer & processMonitor to see what resources are being used by the SelectPDF library and to observe any failures.
Others have reported similar problems, and the SelectPDF site includes some troubleshooting tips here.
Common server-side errors that might cause your (recurring) problem would be things like these:
Out of memory: System.OutOfMemoryException was thrown
File locked by another process: ERROR_SHARING_VIOLATION
. Check the server antivirus exclusions list and make sure the necessary files are excluded from real-time scanning.
Load time exceeded for a very large web page. Try increasing the timeout: converter.Options.MaxPageLoadTime = 120;
The URL of the page to be converted is not properly resolved on the server, even though it resolves properly on the client.
The file size may be too large. If this is the cause, a change to web.config may resolve the problem.
Possible solution for file size too large:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1000000000"/>
</requestFiltering>
</security>
In a situation where PDF creation never works, here are some other things to consider:
Failure due to Error_Access_Denied
. Incorrect (insufficient) permissions on the server. In particular, execute permissions are needed on Select.Html.dep.
PDF creation probably is occurring in a worker thread, and the execution context must permit this.
Wrong version of the converter (32 vs 64 bit).
Missing .dat or .xml files on the server
Trust issues (try <system.web> <trust level="Full" />
)
Mixing up versions intended to run in Web Roles and those intended to run in WebSites (Azure)
Out of memory conditions.
In my case, "Data transmission error 109" was resolved by updating to the latest SelectPdf nuget version. So, it was a software bug inside SelectPdf library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With