WebDocumentViewerConfigurationBuilder.UseFileExportedDocumentStorage(String) Method

Enables exported document file storage and specifies a storage path.

Namespace: DevExpress.AspNetCore.Reporting

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

Declaration

public WebDocumentViewerConfigurationBuilder UseFileExportedDocumentStorage(
    string workingDirectory
)

Parameters

Name Type Description
workingDirectory String

Specifies a path to store the exported documents.

Returns

Type Description
WebDocumentViewerConfigurationBuilder

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

Remarks

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

The exported document is stored in a memory cache and removed from it the first time it is requested. To force the Document Viewer to use a file storage, call 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(); 

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

If you use Web Farms or Garden, switch to the InterProcess synchronization mode (the default mode is InterThread). For this, call the WebDocumentViewerConfigurationBuilder.UseFileExportedDocumentStorage method with the StorageSynchronizationMode.InterProcess parameter.

The cleaner service periodically searches the cache and file storage for expired documents/exported documents/reports and deletes them. You can use the CacheCleanerSettings and StorageCleanerSettings to specify check interval and expiration time settings. To prevent expired documents from being deleted, call the UseEmptyStoragesCleaner() method to register an empty storage cleaner.

See Also