FileCorruptedException when trying to open files

Hello,

We’ve recently been getting FileCorruptedException every time we try to open a word document from our server. This application has been running for about 3 years, without any problems. Recently we had to change virtual directories and ended up with it running on a new application pool. Do note, none of the files ever changed physical location in this process. Just a new virtual directory and application pool.

So now, every time we try and open any document, it gives us a FileCorruptedException.

We get the exception on the following line:

Document doc = new Document(HttpContext.Current.Server.MapPath("/documents/" + FileLocation));
at Aspose.Words.Document.ࠈ(Stream ؟, LoadFormat ࠉ, String ׾)
at Aspose.Words.Document…ctor(String fileName, LoadFormat loadFormat, String password)

We tried a File.Exist on the exact same mappath which returned true. We’re getting this on all the documents, but when copied to our local machines, we can open it in word without a problem.

I think it has something to do with rights, there’s probably a folder that we missed or a setting that we forgot. Could anybody give me a list of users we need to give modify rights to and on what folders to set those rights? (besides the folders the documents themselves are in)

Or is something else going wrong here?

Hello
Thanks for your inquiry. Most likely, you have no permissions to read these documents on your environment. Please make sure you have needed rights.
Best regards,

Hi
Also, for testing, you can try reading your document to stream and then open it from stream using Aspose.Words. If the problem will occurs upon reading the document to stream, then you can be 100% sure that there is some problem with permissions.
Best regards,

Hello Andrey,

Thank you for your help. I tried using the filestream sollution, but i kept getting the same error. Turned out, it was no rights issue at all. The new application pool was set to 64bit. I had to change it back to 32bit. That solved my problem

Hello
Thank you for additional information. It seems the reason of the problem is old version. Could you please try using the latest version of Aspose.Words (10.7.0) and let me know how it goes on your side.
Best regards,

I operate on the wise words “don’t fix what isn’t broken”

If we do encounter any other problems, that’s the first thing i’ll try. Thank you for your help.