Module only shows Media Library items to logged in users

Topics: Troubleshooting, Writing modules
Apr 3, 2014 at 5:42 PM
Edited Apr 3, 2014 at 5:56 PM
I created a very simple module that displays images in a specific folder in the Media Library. It works great when I'm logged in to my Orchard site, but the images are not displayed to anonymous users. Here is a simplified version of my module code:
public ActionResult Image(int id, int? width, int? height) {
            var items = _mediaLibraryService
                                           .GetMediaContentItems("Portfolio", 0, Int32.MaxValue, null, null);
            var mediaItem = items.Where(i => i.Id == id).SingleOrDefault();

            if (mediaItem == null) {
                return null;

            string imageFileName = Server.MapPath(mediaItem.MediaUrl);
            string contentType = "image/" + Path.GetExtension(imageFileName).Substring(1);

            // code to resize image based on given parameters ...

            return File(imageFileName, contentType);
The action accepts the MediaPart id and dimensions, finds the item by id, resizes the image, and returns it as a FileResult. This works fine when logged in, but anonymous users get nothing. Looking in the network tab in Chrome shows that the response length is 0.

Of course, I don't get this behavior when testing locally, only on my live site. Any ideas? I'm using Orchard 1.7.0