Unable to add file to the local file storage

Method : System.String AddFile(System.String, System.IO.Stream)
Message : Unable to add file to the local file storage: path = temp\S\ustyazi.pdf.
Error : .: Unable to add file to the local file storage: path = temp\S\ustyazi.pdf. ---> System.IO.IOException: The process cannot access the file 'C:\EBakanlik\ebakanlik.icisleri.gov.tr\OrtakGeciciUpload\GroupDocs\FileViewerStorage\temp\S\ustyazi.pdf' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.File.Create(String path, Int32 bufferSize)
at System.IO.File.Create(String path)
at Groupdocs.Auxiliary.StreamDownloader.DownloadToFile(Stream stream, String filePath)
at Groupdocs.Storage.LocalFileStorage.AddFile(String path, Stream content)
--- End of inner exception stack trace ---
at Groupdocs.Storage.LocalFileStorage.AddFile(String path, Stream content)
at Groupdocs.Web.UI.Helper.SaveStreamToFile(Stream stream, String streamFileName, String fileExtension, IFileStorage sourceFileStorage, String downloadPath, Boolean useCachedStreamContentsIfPossible, Func`1 streamCreator, String targetElementSelector)
at Groupdocs.Web.UI.ClientHelperBase.ToString()
at System.Web.HttpWriter.Write(Object obj)
at System.Web.UI.HtmlTextWriter.Write(Object value)
at ASP.evrak_fileviewer_fileviewer_aspx.__Renderform1(HtmlTextWriter __w, Control parameterContainer) in c:\EBakanlik\ebakanlik.icisleri.gov.tr\Evrak\FileViewer\FileViewer.aspx:line 45
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer)
at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Control.Render(HtmlTextWriter writer)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.IO.File.Create(String path, Int32 bufferSize)
at System.IO.File.Create(String path)
at Groupdocs.Auxiliary.StreamDownloader.DownloadToFile(Stream stream, String filePath)
at Groupdocs.Storage.LocalFileStorage.AddFile(String path, Stream content)

Hello Arif,


We are sorry to hear that you have such issue. According on the issue log we can assume that the file which you try to view is opened in some other program, for example at the Adobe Acrobat Reader. Please close it and try again.

Best regards.
Do you intend to give up on copying the temp directory before viewing the documents?

Hello,


Thank you for your request. In the temp folder Viewer stores the document cache (images, html and css) which required for viewing the document . Since that we can’t abandon this.

Best regards.