+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Images and Documents Libraries: FileDownloadStream and DirectoryNotFoundException

Images and Documents Libraries: FileDownloadStream and DirectoryNotFoundException

6 posts, 0 answered
  1. Chris Aybar
    Chris Aybar avatar
    25 posts
    Registered:
    20 Oct 2008
    09 Nov 2010
    Link to this post
    We're noticing a large volume of errors in the sitefinity.log of exceptions apparently originating from some images and documents libraries code.  The exception being thrown is System.IO.DirectoryNotFoundException.  We're completely baffled by these errors. Any ideas?

    11/9/2010 1:36:08 PM [UNKNOWN]
    ************************************************************************************
    ID: 848b74e0-6c93-4491-a801-02448cfe6cbd; Code: 3005; Occurrence: 3; Sequence: 119
    ------------------------------------------------------------------------------------

    Application information:
        Machine name: DC-DD9C9F
        OS Version: Microsoft Windows NT 5.2.3790 Service Pack 2
        Product Version: 3.7.2096.2
        Application Path: C:\webroot\sitefinity\
        Debug: False

    Process information:
        Process ID: 6684
        Process Name: w3wp

    Request information:
        Request URL: /Libraries/Images/topnav_global.sflb.ashx
        Rewrite URL: http://www.datacore.com/Libraries/Images/topnav_global.sflb.ashx
        Url Referrer:    Is Authenticated: False
        Authentication Type:
        User:
        User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MDDR)
        User Address: 68.166.115.100

    Variables:
        RadControlRandomNumber: 0
        AspSessionIDManagerInitializeRequestCalled: True
        CmsHttpRequest: /Libraries/Images/topnav_global.sflb.ashx

    - L0 -------------------------------------------------------------------------------

    Exception Type: System.IO.DirectoryNotFoundException

    Message: Could not find a part of the path 'c:\windows\system32\inetsrv\~\App_Data\Files\Libraries\ad2db93f-6db3-4373-a6d7-4d3ae1b9eefb'.

    Source: mscorlib

    Stack Trace:
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
       at Telerik.Libraries.Data.FileSystem.FileDownloadStream..ctor(IContent cnt, FileSystemProvider provider)
    ------------------------------------------------------------------------------------
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    12 Nov 2010
    Link to this post
    Hello Chris Aybar,

    Thank you for using our services.

    It seems that your Images and Documents module is set up to use the files provider for storing images and documents. The errors are caused because the system cannot find the physical store file for your content items. If you have developed your website locally make sure that the ~/App_Data directory. Make sure that you have the contents of the ~/App_Data/Files/Libraries on your live server.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Chris Aybar
    Chris Aybar avatar
    25 posts
    Registered:
    20 Oct 2008
    12 Nov 2010
    Link to this post
    Thanks for the reply.  Yes, the images and documents library is set up to use the files provider for storage. I arrived at the same conclusion you arrived at based on the evidence.  We continue to see these sort of errors for other content items. 

    Now, this could be a feature. That is, the images and documents library was originally set up to use the database provider for storage, but at some later point, the owner decided to change the provider to files (after resources had already been stored in various images and documents libraries).

    What is the default behavior for the images and documents when the provider is changed and there are already saved resources?  Is it possible that the images and documents library files provider is looking on the file system for a specific content item and not finding it because it was originally stored in the database?
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    12 Nov 2010
    Link to this post
    Hello Chris Aybar,

    Thank you for the further clarification.

    With the changes of providers the previously uploaded images will remain in the location they were uploaed to. For example if you have uploaded images while using default provider (database) they will remain there. Only new items uploaded on the files provider will be in the files. That is unless you have used some code to transfer images from one place to the other.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Chris Aybar
    Chris Aybar avatar
    25 posts
    Registered:
    20 Oct 2008
    12 Nov 2010
    Link to this post
    That seems reasonable.  My original theory was that since the images and documents library provider was changed from database to file, it may be searching for content items on the file system, which as you mentioned, are really still only present in the database.  So this begs the question, how does the images and documents library deal with this situation?

    Again, it appears the images and documents library library is looking on the file system for a specific content item and not finding it because it was originally stored in the database.  How can all of the resources be reconciled?  If not, how can these errors be suppressed?

    I would imagine that our solution would be to transfer all content items from the database to the file system in order to suppress these errors, but how can this be accomplished systematically?  Perhaps we need to resort to writing code to iterate through all of the resources stored in the various images and documents libraries and create an entry on the file system for those that do not exist.  We would also have to consider the opposite scenario, the provider being changed from file to database.
  6. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    13 Nov 2010
    Link to this post
    Hi Chris Aybar,

    Thank you for getting back to me.

    The files provider just stores the binary information of the content item in the file system. The rest of the content data - meta fields as well as ID are stored in DB. There's a record for each item in the collection of items which tells the system where the content is saved, so that Sitefinity knows where to look for images or documents. This means Sitefinity will know which images have been stored on DB and will not try to look for them in the App_Data directory.

    Please verify if the website has been developed locally and content has been uploaded locally and the files for this content have been synced with the live version. For a procedure on migrating images from DB to file system you can take a look here: Switching from database to filesysystem for files.


    All the best,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
6 posts, 0 answered