Saturday, August 21, 2021

System.IO.IOException - The file exists --- Dyamics NAV

Hello Experts,

I have face many time below error and it is very hard to find solution first time.

Now i have solution for below issue so though to share with you. 

Error details in event log:

==============================================================

Server instance: DynamisNAV90

Tenant ID: <ii>default</ii>

<ii>Session type: Background

Session ID: 18694

User:

Type: System.IO.IOException

Message:

  <ii>The file exists.

  </ii>

StackTrace:

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

     at System.IO.Path.InternalGetTempFileName(Boolean checkHost)

     at Microsoft.Dynamics.Nav.Runtime.NavReport.GetSaveAsRenderer(String fileName, ReportFormat format, String& tempFilePath)

     at Microsoft.Dynamics.Nav.Runtime.NavReport.SaveAs(DataError errorLevel, Int32 reportId, String fileName, NavRecord record, ReportFormat format)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SaveReportAsHTML_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SaveReportAsHTML(Int32 reportID, NavVariant recordVariant, NavCode layoutCode)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.GetEmailBody_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.GetEmailBody(ByRef`1 serverEmailBodyFilePath, Int32 reportUsage, NavVariant recordVariant, NavCode custNo, ByRef`1 custEmailAddress, NavCode docNo_iRec)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.OnInvoke(Int32 memberId, Object[] args)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SendEmailToCustDirectly_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SendEmailToCustDirectly(Int32 reportUsage, NavVariant recordVariant, NavCode docNo, NavText docName, Boolean showDialog, NavCode custNo)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SendEmailInBackground_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.SendEmailInBackground(INavRecordHandle jobQueueEntry)

     at Microsoft.Dynamics.Nav.BusinessApplication.Record77.OnInvoke(Int32 memberId, Object[] args)

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit260.OnRun_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit260.OnRun(INavRecordHandle εrec)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.RunCodeunit(DataError errorLevel, Int32 objectId, NavRecord record)

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit449.OnRun_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit449.OnRun(INavRecordHandle εrec)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.RunCodeunit(DataError errorLevel, Int32 objectId, NavRecord record)

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.HandleRequest_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.HandleRequest(INavRecordHandle jobQueueEntry)

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.OnRun_Scope.OnRun()

     at Filter.InvokeWithFilter(NavMethodScope )

     at Microsoft.Dynamics.Nav.Runtime.NavMethodScope.Run()

     at Microsoft.Dynamics.Nav.BusinessApplication.Codeunit448.OnRun(INavRecordHandle εrec)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.DoRun(DataError errorLevel, NavRecord record)

     at Microsoft.Dynamics.Nav.Runtime.NavCodeunit.RunCodeunit(DataError errorLevel, Int32 objectId, NavRecord record)

     at Microsoft.Dynamics.Nav.Runtime.NavTaskScheduler.TaskRunInfo.RunCodeunit(Int32 codeunitId, NavRecordRef recordRef)

     at Microsoft.Dynamics.Nav.Runtime.NavTaskScheduler.TaskRunInfo.InternalRun()

Source: mscorlib

HResult: -2147024816

</ii>

=============================================================

This error will come at time of system use the TEMP folder for saving any intermedicate result file.

Like - While Generate word layout report, QR Code Generate, Create Zip File, etc. case

Use will face the error on screen like below.


===========================================

Solution:

Delete files from TEMP folder for below users account:

1) Delete temp file in User Machine

2) Delete temp file from NAV Service Acccount User in NAV Application Server.

You can open the TEMP Folder in user machine by click on RUN and type %temp%


Select All and make sure you delete all .tmp files


Done....

Restart NAV in User Machine and try to do the process.
It will solve the issue.

I hope it will help someone in future.
Thank you for reading

Keep Sharing...Keep Growing....

No comments:

Post a Comment