I get a “System.Net.WebException” error when calling the following code to save an MSG file to PDF. This is a marketing email with lots of external links. I assume the server is no longer available. I have the code in a try catch block but the error is not trapped. I run this in a thread. The thread just terminates and does not report an error to the try catch block.
this line throws the error:
Hi Simon,
Thank you for writing to Aspose Support team.
We have investigated the issue from Aspose.Email’s perspective and the MHTML file is generated fine in no time without any exception. For further investigation, we converted your MSG file to MHT format using MS Outlook. When this file is tried to be opened with MS Word, it takes alot of time to open and doesn’t come back. Aspose.Words seems to resemble the same behavior and it doesn’t seem to be an issue with the API.
Is there a way to get the file to PDF without using Aspose.Words?
Hi Simon,
The ZIP file attached to your first post looks corrupted and cannot be opened. Can you please attach the sample MSG file again for further investigation?
Best Regards,
Your coworkers were able to work with the file. Could the long load time be due to the file corruption?
These emails open just fine in outlook. MS Word and Aspose have issues with them. I think it is a timeout with the rendering of dead links. Since we can open these emails in outlook and even forward them, they are not corrupt.
Upon further investigation, I was able to save the attached MSG file by first opening the MSG file in outlook then doing a FILE\SAVE_AS and saving the file to MHT. That MHT file opens in a browser and renders successfully.
Hi Simon,
Thanks for the details. My colleague Waqas had deleted your sample after testing so we do not have any copy of that message. Can you please share the file again for further investigation?
Best Regards,
Hi Simon,
I was not able to reproduce the issue using the latest version of Aspose.Words (i.e. 15.8.0). I get attached PDF at my end using your code with latest versions of Aspose.Email and Aspose.Words.
Can you please test with the latest versions and let us know if you still see and issue?
Best Regards,
The latest build I see on your downloads page is 15.7 in the bundle.
Hi Simon,
Latest version of Aspose.Words was excluded from Aspose.Total installer because of an issue. It will be fixed soon. You can download 15.8.0 from http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx
Best Regards,
I am getting the same error behavior. I have the sample code you tested inside a .NET SYSTEM.THREADING.TASKS.TASK thread. Is this code thread safe?
Hi Simon,
Yes, it is. Can you please share a simple console application to reproduce the issue?
Best Regards,
The attached console application hangs up on this line:
The same code hangs both inside thread and if you just run the function outside of a thread.
Hi Simon,
Sorry, I was still unable to reproduce the issue using the latest versions of Aspose.Words and Aspose.Email. I was able to successfully run your sample many times. The only issue I see is that it takes some time in downloading external resources but there is no exception and PDF is generated successfully.
From error description it looks like there is some network issue at your end while downloading external resources. Can you please confirm if your network was working fine when you tested it?
Best Regards,