More in this section

Forums / General Discussions / SF 4.1 does not server static images properly (404 error)

SF 4.1 does not server static images properly (404 error)

46 posts, 0 answered
  1. Pavel
    Pavel avatar
    14 posts
    Registered:
    25 Sep 2007
    18 Apr 2011
    Link to this post
    We just tried installed SF4.1 and ran into issues displaying static images (see attached). Only images generate the 404 errors. The images are in /images folder and the project stopped working correctly under both Visual Studio and IIS7.
  2. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    18 Apr 2011
    Link to this post
    I'm having the same problem on multiple sites. Images that are served up from css and the images are under app_data folder display ok, but the simplest html like <img src="/images/test.jpg"/> gives a 404 error.

    It would also appear that SF 4.1 has broken my jquery scripts that previously worked file in 4.0, still need to investigate more as to what's going on here but it worked fine before the upgrade and broke after, the only thing I did was upgrade.

    There's gotta be a simple fix for this because if this is intended behaviour or a bug that missed testing someone needs to be fired for sure!

    I know everyone at Telerik is probably exhausted but would love a fix for this one asap!

    Regards,
    Phill
  3. Michael
    Michael avatar
    3 posts
    Registered:
    04 May 2009
    18 Apr 2011
    Link to this post
    Static image files work fine when served out of anything except an "images" folder in the root.  The "images" folder is used in URLs for serving Image content, so I imagine the changes under the hood with the virtual path provider are responsible for this.  Anyway, I hope there's a simple way around this.  :)
  4. Noah
    Noah avatar
    6 posts
    Registered:
    22 Dec 2008
    18 Apr 2011
    Link to this post
    Hello,

    Here is the error from the ~/App_Data/Sitefinity/Logs directory.  I will try using a dir without "images".

    Thanks
    -Noah

    ----------------------------------------
    Timestamp: 4/18/2011 9:43:30 PM
     
    Message: HandlingInstanceID: 6fe0253f-e853-4f92-8e35-6a92483ff294
    An exception of type 'System.Web.HttpException' occurred and was caught.
    ------------------------------------------------------------------------
    04/18/2011 16:43:30
    Type : System.Web.HttpException, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
    Message : File not found.
    Source : Telerik.Sitefinity
    Help link :
    WebEventCode : 0
    ErrorCode : -2147467259
    Data : System.Collections.ListDictionaryInternal
    TargetSite : Void SendResponseAndSetCaching(System.Web.HttpRequest, System.Web.HttpResponse, Telerik.Microsoft.Practices.EnterpriseLibrary.Caching.ICacheManager, System.String)
    Stack Trace :    at Telerik.Sitefinity.Modules.Libraries.Web.LibraryHttpHandler.SendResponseAndSetCaching(HttpRequest request, HttpResponse response, ICacheManager cache, String key)
       at Telerik.Sitefinity.Modules.Libraries.Web.LibraryHttpHandler.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
     
    Additional Info:
     
    MachineName :
    TimeStamp : 4/18/2011 9:43:30 PM
    FullName : Telerik.Sitefinity.Utilities, Version=4.1.1339.0, Culture=neutral, PublicKeyToken=b28c218413bdf563
    AppDomainName : /LM/W3SVC/29/ROOT-3-129476334671159765
    ThreadIdentity : Anonymous
    WindowsIdentity : NT AUTHORITY\NETWORK SERVICE
    Requested URL : /images/partners/nten.gif
     
     
    Category: ErrorLog
     
    Priority: 0
     
    EventId: 90000
     
    Severity: Error
     
    Title:Enterprise Library Exception Handling
     
    Machine: SV2522
     
    App Domain: /LM/W3SVC/29/ROOT-3-129476334671159765
     
    ProcessId: 12460
     
    Process Name: c:\windows\system32\inetsrv\w3wp.exe
     
    Thread Name:
     
    Win32 ThreadId:9768
     
    Extended Properties:
    ----------------------------------------
  5. reAnimated
    reAnimated avatar
    11 posts
    Registered:
    27 Apr 2009
    18 Apr 2011
    Link to this post
    The route handler which  serves images, documents and videos from the Sitefinity libraries detects the request to the image containing /images in the path and tries to find the file in the images and documents. Since it does not find it there it throws 404.

    I would suggest that you use the approach mentioned by Michael
  6. Noah
    Noah avatar
    6 posts
    Registered:
    22 Dec 2008
    18 Apr 2011
    Link to this post
    Hello,

    Using a dir such as /img/ instead of /images/ does work.

    Thanks
    -Noah
  7. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    18 Apr 2011
    Link to this post
    You've got to be kidding me!!! "images" has to be the most commonly used name for a folder to store images when building a site and you're now telling me that I can't use it anymore because you decided to hard code it into your image handler?? I have to update master pages, embedded widget templates (find and replace won't work here), user controls, css files and who knows where else across multiple sites???? Not to mention that I have to re-educate clients to tell them they can't use a folder called "images" even though they've used a folder like that since the beginning of the internet?

    Seriously this has to be a joke! I can zip up 3 sites, all templates and databases so you can do it for me if you think this is a realistic fix and you can also contact my clients to tell them why they can't use this folder.

    So common, what's the real fix here, one that actually makes sense in the world of web development.

    So far SF 4.1 is one step forward and 2 steps back for me. I have upgrade 3 sites and none of them are working yet...

    Phill
  8. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    19 Apr 2011
    Link to this post
    I sadly am also on 3 attempted updates with 0 working :/. One was volatile so just blew it away and created a new project...that all worked great... ;). I'm not going to try anymore, killed too many hours tonight.
  9. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    19 Apr 2011
    Link to this post
    Hi Steve,

    “Images” is the default root mapping for images stored in Sitefinity’s Libraries module. In version 4.1 the Sitefinity’s virtual paths cannot match with physical paths for Libraries. This is necessary for performance reasons. To avoid this conflict you have to rename the physical folder or change the virtual root in Libraries configuration. To change the configurations please go to:~/Sitefinity/Administration/Settings/Advanced>Libraries>Images>UrlRoot  and change the value to something like “sf-images”.

    Sorry that we missed this from the release notes - we will make it a KB article.

    Greetings,
    Georgi
    the Telerik team

  10. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    19 Apr 2011
    Link to this post
    Dear Georgi

    Is there  a way you change the default for the next SP

    ~/Sitefinity/Administration/Settings/Advanced>Libraries>Images>UrlRoot  and change the value to something like “sf-images”.

    Or will this cause to much trouble for those who have not amended before starting the project. Otherwise this 'error/problem' will carry on for generations :-)

    Markus
  11. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    19 Apr 2011
    Link to this post
    @Georgi

    I am not sure if your tip realy is the best ever.

    See image. Run into problems.

    Deleted the one and only image and uploaded again - not showing.

    Markus
  12. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    19 Apr 2011
    Link to this post
    @Georgi, I agree with Markus. This fix may allow for images to be stored in images folder but it also breaks all images already stored in albums. So what's the second part of the fix? Why do you allow users to change settings that don't actually update the data? You can't actually expect someone to change a setting and then to have to start their entire site from scratch each time can you?

    Still struggling to get a single site upgraded to 4.1 so I have no idea if there are any improvements as I keep running into problems.
  13. Pavel
    Pavel avatar
    14 posts
    Registered:
    25 Sep 2007
    19 Apr 2011
    Link to this post
    Issue is extremely critical at this point. I'd like to see a complete and tested and various configurations solution.
  14. Pat
    Pat avatar
    20 posts
    Registered:
    18 Feb 2003
    19 Apr 2011
    Link to this post
    Hi,
    I changed ~/Sitefinity/Administration/Settings/Advanced>Libraries>Images>UrlRoot to "sf-images" but the images are not showing up. Am I missing something?
  15. Jeff
    Jeff avatar
    6 posts
    Registered:
    01 Jun 2010
    19 Apr 2011
    Link to this post
    Georgi,

    I also agree with Markus.  I'm fortunate enough to be dealing with a site that isn't live yet so I didn't run into the same error he did, but seeing that Sitefinity assumed "images" for its default location worries me.  Am I going to be running into other unnecessary issues like this when upgrading in the future?

    I realize assuming defaults like this helps those using Sitefinity out of the box, but working around Sitefinity's assumptions has been a nightmare as a developer.
  16. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    20 Apr 2011
    Link to this post
    Hi Jeff,

    Alright guys - do you have any suggestions what URL can be reserved for Sitefinity library images? It can be something like sf-images, sf-documents, library-images?

    Kind regards,
    Georgi
    the Telerik team

  17. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    20 Apr 2011
    Link to this post
    Dear Georgi

    1) sf_ or sf- would be fine with me

    Since sf_ is used in the tables you could argue

    a) It is consisten to use sf_
    b) it would be better to use sf- to distinguish

    2) I think a change is defenitely needed away from images. Just make sure its a smoot transaction and/or bring it as early as possible so the mess would be as small as possible.

    Kind regards
    Markus
  18. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    20 Apr 2011
    Link to this post
    @Georgi, I'm glad you're reacting to this fast as I think this is a serious issue, it could be minor now but down the road you'll get endless support requests from people wondering why their images folder doesn't work. I'm also fine with the "sf-" or "sf_" prefixes. It may not be possible but I think an even cleaner solution would be to differentiate by having everything through a filtered parent folder. So all images (and videos, docs and any future items that might be allowed in a libary) are always served from a special SF library folder. So instead of having /sf-images/imagename.jpg you'd have "/sitefinity/images/imagename.jpg" or even better "/library/images/imagename.jpg" with "library" being the only reserved folder/file name. This would allow for easy addition of anything else like "/library/pdfs/file.pdf", "/library/videos/file.mov" They would all have a very standard naming convention and no need for customizing folder names as new data types are added.

    That's my 2 cents.

    Thanks again!
    Phill
  19. AmrElsayed
    AmrElsayed avatar
    87 posts
    Registered:
    18 Jul 2012
    20 Apr 2011
    Link to this post
    Is the solution suggested below for changing the virutal root of libraries working in the current Q1, we can't get this to work even after restarting the site? Any ideas?
  20. Phill Hodgkinson
    Phill Hodgkinson avatar
    362 posts
    Registered:
    10 Nov 2004
    20 Apr 2011
    Link to this post
    @AmrElsayed the fix worked for me but it also meant that any images that were stored in libraries were then broken. So it fixed one thing and broke another. They've now updated the knowledge base article with a script for fixing the broken libraries.

    See here: http://www.sitefinity.com/devnet/kb/sitefinity-4-x/static-files-are-not-served-from-images-or-videos-folders.aspx

    Hope that helps.
    Phill
  21. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    20 Apr 2011
    Link to this post
    I like Phills idea but would prefer to have it under
    sitefinity/libraries

    so everything is within the sitefinity folder

    What about once the files can be storred on the server instead of the db. Is this something to be considerd now?

    At the moment if I am correct they are storred in app_data/Files/Libraries as binary files in 3.7

    Regards Markus

    PS: I would love the file provieder to save each library in a own folder and the files in real format - mydoc.doc instead of binary.
  22. AmrElsayed
    AmrElsayed avatar
    87 posts
    Registered:
    18 Jul 2012
    20 Apr 2011
    Link to this post
    Thanks Phil, that works.
  23. Pavel
    Pavel avatar
    14 posts
    Registered:
    25 Sep 2007
    20 Apr 2011
    Link to this post
    My understanding is that Sitefintiy 4.1's implementation of the Virtual Path Provider does not allow for same path to be used as both physical and virtual for 'performance' reasons. This leads me to think that there could be issues with using /sitefinity/images or whatever, same way there is issues with 'images' today...

    IMO, the Virtual Path Provider needs fixing so folder names are not involved at all.
  24. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    20 Apr 2011
    Link to this post
    I am glad a new convention for the default library path is being discussed. I like Phill's idea of using /library/images/ or /sitefinity/images/ as a convention. /library/... is perhaps more straight-forward.

    @Georgi, thank you for writing that KB and addressing this. @Phill, thank you for posting the link.
  25. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    20 Apr 2011
    Link to this post
    @Pavel

    My understanding is not so high as yours but there will not be a sitefinity/images folder. So there would not be a problem. To me having it all under sitefinity makes it a bit more enduser proof. Kind of don't touch anything in the Sitefinity folder.

    Markus

    @Phill
    Thanks for the link

    @Georgi
    Thanks for the file

    @all
    Thanks for your engagement.

    Markus
  26. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    20 Apr 2011
    Link to this post
    I'm starting with a blank SF 4.1 site where I tried setting the UrlRoot for Images to a different path. I tried library/images, and while this seemed to build the path correctly, it 404'd. I tried simplifying and just using images_library for the UrlRoot, but that failed too. In both cases I removed any existing albums and re-uploaded my images. I also tried running the script from the KB article, but no luck.

    I am wondering if anyone can confirm what worked for them.

    Also, +1 to the physical storage option that Markus suggested. I remember this was discussed previously but I don't recall what was going to happen. There are definitely scenarios when having a physical storage option is useful. Using the real extensions would be important too.
  27. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    20 Apr 2011
    Link to this post
    @Will

    I think Q2 was the schedule for FileSystem storage (and cloud providers too?)...I have a 300M database so far due to DB storage of PDFs so Georgi please look into some code to allow us to extract that out when the other storage options hit :)
  28. Will
    Will avatar
    23 posts
    Registered:
    30 Jun 2009
    21 Apr 2011
    Link to this post
    Can anyone confirm if changing the UrlRoot worked for them, and what path they used?

    Thanks!
  29. Pavel
    Pavel avatar
    14 posts
    Registered:
    25 Sep 2007
    21 Apr 2011
    Link to this post
    @Will I can confirm the UrlRoot worked for us (we chose sf-images). However, we reverted back and chose to rename the original static 'images' folder  to 'i' and let the Sitefinity module continue use '/images/' because our client already had created about 300 pages and inserted Image module content in them. Because of that the pages content either has to be updated or Image Urls have to be recompiled via script shown in the recent KB article (which did not exist at the time we were working on the issue).

    Hope it helps.
  30. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    22 Apr 2011
    Link to this post
    Hi,

    @Steve - we will have copy/move group operations, so you will be able to move your data between the providers. This is coming in Q2 indeed.

    @Pavel - thanks for helping to community members!

    @Will - let us know if Pavel's info is sufficient for you to find the issue.

    Best wishes,
    Georgi
    the Telerik team

46 posts, 0 answered
1 2