1
Error message trying to display image files
Question asked by Adam Short - 7/26/2019 at 2:38 AM
Answered
Hi, I'm evaluating your DocumentUltimate product for use in our applications and I've run into a strange issue. When I attempt to view image files I get this error:

Exception:
     Message: Could not open a temporary file. Make sure to close unused documents.     Conditional expression: m_stream != NULL     Version    : 3.0.0            Filename   : TempFile.cpp     Function   : trn::SDF::TempFile::OpenTempFile     Linenumber : 142

This looks like a permissions issue with the cache folder, but I don't think it is, since I can view other types of files with no problem. Office files, emails, PDFs all work fine, and are correctly cached, always to the same cache folder.

Any ideas what could be preventing this from working? I have downloaded your demo application and that seems to work perfectly with images, so it must be something I'm doing, but I'm struggling to see what.

The code in my controller looks like this:
           
DocumentUltimateWebConfiguration.Current.CacheLocation = @"E:\DocumentLibrary\Cache";
var documentViewer = new DocumentViewer()
{
    Width = 500,
    Height = 600,
    Resizable = false
};

documentViewer.Document =
    //"E:\\DocumentLibrary\\DocumentTemplates\\Court\\Court Forms Witness Summons Crime.docx";
    "E:\\DocumentLibrary\\DocumentTemplates\\Images\\search.jpg";
    //"E:\\DocumentLibrary\\DocumentTemplates\\Other\\Informing of closure.msg";
    //"E:\\DocumentLibrary\\DocumentTemplates\\Other\\MatterProductCounts.xlsx";
    //"E:\\DocumentLibrary\\DocumentTemplates\\Other\\Template - Copy.csv";
return PartialView("~/Views/Matter/MatterHome/Content/Documents/_DocumentPreview.cshtml",
                documentViewer);
The commented lines all work perfectly. The only one that doesn't work is the uncommented line. The content of the partial view is simply:

@using GleamTech.AspNet.Mvc
@using GleamTech.DocumentUltimate.AspNet.UI
@model DocumentViewer

@this.RenderBody(Model)
Not much to go wrong there. I've also included the RenderHead method call in the layout page for this page, so everything is correct as far as I can see (and indeed it's working fine with most filetypes).

Any idea what the problem could be?

1 Reply

Reply to Thread
0
Cem Alacayir Replied
Employee Post Marked As Answer
Hi,
This seems to be a writing permission problem on the temporary folder.
 
  1. Add the IUSR, Network Service (and your other Windows accounts which your app pool uses) to IIS_IUSRS group
  2. Run iisreset in Administrator Command Prompt so that the change takes in effect.
 
This will grant permissions to “Temporary ASP.NET Files” folder as IIS_IUSRS group already has access to it. 

Note that the problem may not happen with all file formats but some because only some formats may need a temporary file.

Reply to Thread