You are viewing limited content. For full access, please sign in.

Question

Question

Laserfiche Error The process cannot access the file '**********' because it is being used by another process.

asked on August 2, 2016 Show version history

I have this code in a C# script Workflow: 

I get the Id from a entry that Import Agent impor to our repository.

int.TryParse(this.GetTokenValue("Entry ID").ToString(), out id);
        public void ExportEntries(int id)
        {
            try
            {
                DocumentInfo docInfo = Document.GetDocumentInfo(id, RASession);
                DocumentExporter docEx = new DocumentExporter();
                docEx.PageFormat = DocumentPageFormat.Tiff;
                docEx.CompressionQuality = 90;

                if(!Directory.Exists(@"E:\PathToExportEntriesTiff\"))
                {
                    Directory.CreateDirectory(@"E:\PathToExportEntriesTiff\");
                }

                docEx.ExportPages(docInfo, docInfo.AllPages, @"E:\PathToExportEntriesTiff\" + docInfo.Name + ".tif");
                docInfo.Dispose();
            }
            catch(Exception ex)
            {
                string filePath = @"E:\PathToExportEntriesTiff\ERROR_TO_EXPORT.txt";

                using (StreamWriter writer = new StreamWriter(filePath, true))
                {
                    writer.WriteLine("Response :" + ex.Message + Environment.NewLine +
                    "" + Environment.NewLine + "Numero Contrato: " + this.GetTokenValue("Entry Name").ToString() +
                    "" + Environment.NewLine + "Path: " + this.GetTokenValue("Entry Path"));
                    writer.WriteLine(Environment.NewLine + "-----------------------------------------------------------------------------" + Environment.NewLine);
                }
            }
        }

And i'm getting this error => The process cannot access the file '**********' because it is being used by another process.

 

Someone could explain why ?

0 0

Answer

SELECTED ANSWER
replied on August 2, 2016

Are you getting on the file you're trying to export or on the error log file you're trying to write?

How is this workflow triggered? It's possible that multiple instances are either trying to export the same file at the same time or trying to write to the same error log file at the same time.

0 0
replied on August 2, 2016 Show version history

I'm trying to export the pages from a entry to Tiff format. The workflow is triggered by creation event.

 

I'll trying your ideas Miruna Babatie.

0 0

Replies

replied on August 2, 2016

Try using process explorer and/or process monitor to see which processes are accessing the file, it might be a virus scanner interfering.

0 0
replied on August 2, 2016 Show version history

Thanks, i'll try...

 

There is no anti-virus running in my Workflow server. Through the process explorer no other process is trying to access the file.  Any others ideas are welcome...

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.