System.IO.IOException: The file exists.

  • Thread starter Thread starter Wesley Wu
  • Start date Start date
W

Wesley Wu

When I called System.IO.Path.GetTempFileName() in my
static method it produced a error below:

------------------------------------------------------
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and
where it originated in the code.

Exception Details: System.IO.IOException: The file
exists.

Source Error:

An unhandled exception was generated during the execution
of the current web request. Information regarding the
origin and location of the exception can be identified
using the exception stack trace below.

Stack Trace:


[IOException: The file exists.
]
System.IO.__Error.WinIOError(Int32 errorCode, String
str) +723
System.IO.Path.GetTempFileName() +90
Mindsware.Core.Utility.AttachmentUtil.GetTempFileName
() in D:\Documents and Settings\Administrator\My
Documents\work\Java\Mindsware_DynamicDataObjects\Mindsware
\Core\Utility\AttachmentUtil.cs:18

Mindsware.Core.Utility.AttachmentUtil.SaveByteArrayToFile
(Byte[] byteArray) in D:\Documents and
Settings\Administrator\My
Documents\work\Java\Mindsware_DynamicDataObjects\Mindsware
\Core\Utility\AttachmentUtil.cs:25
Mindsware.Core.Db.DBFieldInfo.FormatDataValue(Object
dataValue) in D:\Documents and Settings\Administrator\My
Documents\work\Java\Mindsware_DynamicDataObjects\Mindsware
\Core\Db\DBFieldInfo.cs:322

BonusPoint.Application.BonusEncashForm.RenderBonusGoodsTab
le(Int32 intPointUpperLimit) in
d:\inetpub\wwwroot\BonusPoint\Application\BonusEncashForm.
aspx.cs:285
BonusPoint.Application.BonusEncashForm.Page_Load
(Object sender, EventArgs e) in
d:\inetpub\wwwroot\BonusPoint\Application\BonusEncashForm.
aspx.cs:99
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
------------------------------------------------------

This website worked just fine for months until the day
before yesterday. I did not even change anything before
it failed to work.

I checked all the KB and found no answer. I googled and
noticed that one guy said he met this condition but no
one explained why after his admission.
 
I just saw the same error. In my case the directory I was creating the files
in got 255 tmpXX.tmp files and my code started throwing the error. It seems
extremely awful if .Path.GetTempFileName() can only generate 255 names! Did
you find anything else out?
 
Back
Top