I've setup an API service to receive a document request, copy it to an input stream, then LoadFromStream to a Spire.Doc Document. When submitting multiple requests at the same time (ie. 5 word document requests); i receive an error: Collection was modified; enumeration operation may not execute. How can I make this thread safe? In the forum, there were two other posts from 2014/2015, but not a clear solution.
httpRequest.Files[0].InputStream.CopyTo(ms);
Document document = new Document();
document.LoadFromStream(ms, FileFormat.Auto); <--- Error occurs here when two documents process at the same time.
I have tried the decorator [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, InstanceContextMode = InstanceContextMode.Single)], but that didn't seem to solve the issue.