documentBuilder: The process cannot access the file because it is being used by another process
Posted
by
st mnmn
on Stack Overflow
See other posts from Stack Overflow
or by st mnmn
Published on 2012-03-27T11:25:29Z
Indexed on
2012/03/27
11:29 UTC
Read the original article
Hit count: 376
I am using DocumentBuilder (of openXML api), to those who doesn't know the documentBuilder I'll give a short explanation: it has a function 'BuildDocument' which gets list of sources (each source contains wmldocument), and string of fileName to save to.
public static void BuildDocument(List<Source> sources, string fileName)
the purpose of this function is to build one word docx which contains all the sources. it merges some docs to one. at the end of its functionality it saves the doc using:
File.WriteAllBytes(...)
but when I run my project on the server I keep getting the error: "The process cannot access the file because it is being used by another process." few times it works ok. and in the visualStudio it also works without errors. what can be the problem?
© Stack Overflow or respective owner