Viewer works locally, but not in Azure App Service

I am having a problem. I’ve tried everything I can think of, but I can’t get it to run in our Azure app service.

I’m using the code sample for the MVC Web Farm scenario.

In Azure, the file access is limited, but there is a %HOME%\site folder you can use to store files (see Operating system functionality - Azure App Service | Microsoft Learn). This maps to C:\home\site, so I’m using C:\home\site\doconut as my DoconutPngExportPath.

When I run it locally, it works perfectly, but when I run it in Azure, the Controller GET handler runs completely, but when the page loads I get an alert:

image.png (17.7 KB)

Followed by

image.png (24.4 KB)

And then it redirects to DocImage.axd with a “Missing document instance” message

image.png (22.4 KB)

I’ve added logging code that indicates the ExportDocumentToPng is creating the files. I’m just not sure why it’s not able to read those files afterwards.

I’ve attached the relevant files:
Doconut.zip (3.1 KB)

@AlanWaiss,

Could you please send a complete example project without personal information so I can evaluate the problem?

This way I can better help you identify the issue that is occurring.
Thanks for your help.

Sorry, I’m just now getting back to this issue. I don’t have a complete example project, but additional info:

I’ve updated our application to mount an Azure storage account and I’m using that as the DoconutPngExportPath.

image.png (22.1 KB)

image.png (3.8 KB)

Looking at the storage after loading the document viewer view, I can see it generated files in the appropriate place.

image.png (197.7 KB)

I’ve downloaded these files and they all look OK.

image.png (177.4 KB)

In the actual viewer, though, I’m mostly getting “Missing document instance.”

image.jpg (66.3 KB)

If I look at the , I see DocImage.axd handlers. If I load this in a new tab and just refresh the page, it sometimes loads the appropriate file and sometimes loads “Missing document instance” for the same URL.

image.png (163.8 KB)

image.png (29.9 KB)

@AlanWaiss,

Can you please download the latest sample package from the Doconut.com website?

In the following path you can find a sample using Azure:

Samples\NET Core\Cloud\Core.Cloud.Azure

Let me know if you have other questions.

We are using .NET Framework 4.8 and that sample is .NET Core.

It looks like it uses DocumentViewer’s ExportToCloud - which I assume will store the temp files in Azure blob storage. That would be great so we wouldn’t need to mount the storage as a drive.

Is there a .NET Framework equivalent to the DocImage.axd handling in Startup.cs? It looks like the DocImage.axd handler would need to know to read from blob storage. Or is there a way to configure the handler?

@AlanWaiss,

There is a sample in the Doconut ZIP for Webforms but it is very outdated.

This is the path of the sample:
\Samples\NET Framework 4.7\Cloud\WebForms.Cloud

Take a look in the web.config file in:

<system.webServer>
  <handlers>

You need to config the node with the attribute name "DocImage".

In the comments on the web.config, you can see how to configure Azure with AzureStorageImageHandler.