Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, February 17, 2017 12:35:32 PM(UTC)

maneka  
maneka

Groups: Registered
Posts: 17

Thanks: 1 times

Hi Hadi,

the service is now correctly running thank you however I am getting the error stating that cache has not been setup. I have set the app setting value for the cache directory. Is there any documentation stating how to setup the caching

Code:

<add key="lt.Cache.Directory" value="C:\Development\Assets\Cache"/>
  <add key="lt.Cache.VirtualDirectory" value="http://core/_cache"/>


the c# code is as follows

Code:


var loadOptions = new LoadDocumentOptions();
            loadOptions.UseCache = true;
            loadOptions.CachePolicy = ServiceHelper.CreatePolicy();
            loadOptions.WebClient = null; 
            
            
            if (request.Options != null)
            {
                loadOptions.AnnotationsUri = request.Options.AnnotationsUri;
                loadOptions.Name = request.Options.Name;
                loadOptions.Password = request.Options.Password;
                loadOptions.LoadEmbeddedAnnotations = request.Options.LoadEmbeddedAnnotations;
                loadOptions.MaximumImagePixelSize = request.Options.MaximumImagePixelSize;
            }
            var documentName = request.Uri.ToString();

            //Check if this document was uploaded, then hope the user has set LoadDocumentOptions.Name to the original file name
            if (DocumentFactory.IsUploadDocumentUri(request.Uri) && !string.IsNullOrEmpty(loadOptions.Name))
            {
                // Use that instead
                documentName = loadOptions.Name;
            }

            var originalSetting = DocumentConverterPreferences.TryEnableTextFilter(DocumentFactory.RasterCodecsTemplate, documentName);
            try
            {
                Document document = null;
                try
                {
                    // first, check if this is pre-cached
                    if (PreCacheHelper.PreCacheExists)
                    {
                        string documentId = PreCacheHelper.CheckDocument(request.Uri, loadOptions.MaximumImagePixelSize);
                        if (documentId != null)
                            document = DocumentFactory.LoadFromCache(documentId);
                    }
                    if (document == null)
                    {
                        document = DocumentFactory.LoadFromUri(request.Uri, loadOptions);
                        if (document == null)
                            throw new InvalidOperationException("Failed to load URI: " + request.Uri);
                        ServiceHelper.SetRasterCodecsOptions(document.RasterCodecs, request.Resolution);
                        document.AutoDeleteFromCache = false;
                        document.AutoSaveToCache = false;
                        document.SaveToCache(); // The exception is thrown at this line
                    }
                    return new LoadFromUriResponse { Document = document };
                }
                finally
                {
                    if (document != null)
                        document.Dispose();
                }
            }
            finally
            {
                DocumentConverterPreferences.RestoreTextFilter(DocumentFactory.RasterCodecsTemplate, originalSetting);
            }


Thank you
Maneka
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, February 17, 2017 3:37:23 PM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 218

Was thanked: 12 time(s) in 12 post(s)

Hey Maneka,

I created a new forum topic for this question since it was unrelated to the previous question.

The VirtualDirectory may be an absolute or relative path to a visible location on the server from the application root.

Here is more information on the CacheVirtualDirectory:
https://www.leadtools.co...toolkit-and-caching.html

It may be that your service cannot access the virtual directory that you are defining in the config file that you pasted above.

Edited by user Wednesday, November 25, 2020 8:07:25 AM(UTC)  | Reason: Not specified

Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.066 seconds.