0

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:

  • The IIS logs show an HTTP 200 result.
  • The XML files we are testing are anywhere from 3 to 14MB in size.
  • The XML file is in a subdirectory under the inetpub/wwwroot folder.
  • The XML file is being served using StaticFileModule with the path *.xml.

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 }

DavGarcia
  • 18,540
  • 14
  • 58
  • 96
  • I am not sure if you are talking about 206 partial content, https://www.rfc-editor.org/rfc/rfc9110#name-206-partial-content but if so, then there is nothing to talk about further as that's part of the standard. – Lex Li Aug 18 '22 at 02:27
  • It is difficult to reproduce your problem based on your description, I suggest you open a case via: https://support.microsoft.com. – samwu Aug 18 '22 at 07:23

0 Answers0