Subscribe

Close

Thank you for visiting!

Please consider subscribing to the RSS feed or following me on Twitter.

Fixing "The file exists" IOException Error

If you get the System.IO.IOException: The file exists error, it's probably because your C:/Windows/Temp folder is absolutely full with temporary files. In fact, if you have more than 65535 files in your temp folder, the method GetTempFileName will throw this error.

To resolve this, just remove all temporary files in C:/Windows/Temp. It might take some time, but it will solve the problem.

Here's the stack trace I got:

System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   System.IO.Path.GetTempFileName()

Comments

I got that problem once on a live server. very annoying, and the question is why the temp files doesnt automatically gets deleted before the problem appears...

To the top