Windows Server 2008 R2: How to force writing of a file to disk, past any disk cache, so other processes reading the file get its entire contents?

view full story

http://serverfault.com – I have a Windows Server 2008 R2 cluster, running a 3rd party trained algorithm that generates geometry and texture maps at high speeds. This is part of a WebAPI, with clients generating new geometry and texture maps on demand. About 1% of the time, when retrieving the largest texture map (a bit over a 1M in size), logic that knows the file size of this file compares the just-loaded-file size with the expected size, and the entire file is not completely there on disk yet. In the WebAPI logic, I try rereading the file when detecting the entire thing is not being loaded, but the results are the (HowTos)