WebDocumentViewerConfigurationBuilder.UseFileExportedDocumentStorage(String) Method

Specifies a path for the exported document's file storage.

Namespace: DevExpress.AspNetCore.Reporting

Assembly: DevExpress.AspNetCore.Reporting.v18.1.dll

Syntax

public WebDocumentViewerConfigurationBuilder UseFileExportedDocumentStorage(
    string workingDirectory
)

Parameters

Type Name Description
String workingDirectory

Specifies a path to the directory where exported documents should be stored.

Returns

Type Description
WebDocumentViewerConfigurationBuilder

A WebDocumentViewerConfigurationBuilder that can be used to further configure the Web Document Viewer services.

The Document Viewer uses a cache or file storage to get the exported document in the following cases:

  • an asynchronous export mode is on explicitly;
  • content editing is enabled in the exported document;
  • when the Document Viewer displays a document from the ReportServer.

By default, the exported document is stored in a memory cache and removed from it the first time it is requested. You can make the Document Viewer to use a file storage instead. For this purpose, use the UseFileExportedDocumentStorage method.

The following code demonstrates how to use the UseFileExportedDocumentStorage method to specify a file storage for the Document Viewer.

using DevExpress.AspNetCore;
using DevExpress.AspNetCore.Reporting;
//... 

public class Startup {
//... 
    string contentRootPath;
    public Startup(IHostingEnvironment env) {
        contentRootPath = env.ContentRootPath;
        //...
    };
    public void ConfigureServices(IServiceCollection services) {
        services.AddDevExpressControls();
        services.AddMvc().AddDefaultReportingControllers(); 

        services.ConfigureReportingServices(configurator => {
            configurator.ConfigureWebDocumentViewer(viewerConfigurator => {
                viewerConfigurator.UseFileExportedDocumentStorage(System.IO.Path.Combine(contentRootPath, "ExportedDocumentStorage"));
            });
        });        
    }
//...    
}
Tip

Use the UseFileExportedDocumentStorage(String, StorageSynchronizationMode) method overload to specify the InterProcess synchronization mode for the file storage if you use Web Farms or Garden. By default, the InterThread mode is set.

According to the time settings specified in the CacheCleanerSettings and StorageCleanerSettings classes, the default cleaner service periodically checks if the cache and file storage contain exported documents whose lifetime exceeds a specific amount of time. If such documents are found, they are deleted. Call the UseEmptyStoragesCleaner() method to register an empty storage cleaner instead of the default one, so that documents are not removed automatically.

See Also