In case our file server runs slowly and the page does not finish by its timeout, ASP.Net will hit it with a ThreadAbortException exception. If this happens inside Win32Native.CreateFile, this leaves the file descriptor locked until we execute iisreset.
Is this a .NET flaw? Is there anything we can do in this case, apart from bad ideas, such as raising the timeout to some gigantic number ... I don’t think ThreadAbort.Reset will help, because the damage has already been done and I didn’t even return the file descriptor from FileStream to close it myself.
at Microsoft.Win32.Win32Native.CreateFile (String lpFileName, Int32 dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES securityAttrs, FileMode dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplate)
at Microsoft.Win32.Win32Native.SafeCreateFile (String lpFileName, Int32 dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES securityAttrs, FileMode dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplate
in System.IO.FileStream.Init (String path, FileMode mode, access to FileAccess, Int32 rights, useRights boolean, FileShare share, Int32 bufferSize, FileOptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
System.IO.FileStream..ctor( String, FileMode, FileAccess, FileShare, Int32 bufferSize, FileOptions, String msgPath, Boolean bFromProxy)
System.IO.FileStream..ctor( String, FileMode)