DavGarcia
DavGarcia

Reputation: 18822

IIS 10 serve static file truncated if being written to

Using IIS 10 to serve a static XML file is causing the file to be occasionally truncated. There is a separate process that frequently rewrites the file using some C# code within another application in IIS on the same server. If there is a web request for the file at the same time as the file is being written, IIS will serve up a truncated file. This is happening often enough to be noticeable.

Some context:

I'm kinda surprised by this behavior. I would think that if the file is being written, Windows would wait until the file is complete?

The C# process that is writing the file is executing:

using (StreamWriter outfile = new StreamWriter(filePath, true)) { // Write stuff here }

Upvotes: 0

Views: 146

Answers (0)

Related Questions