I created a IIS website about a year and a half ago with a lot of pictures on various aspx/asp tabbed pages. My development PC is Windows 8.1 Pro with IIS version 8.5.9600.16384 website. The website was developed using Visual Studio 2012. The website was published onto the same Windows PC.
The published website was then copied onto a Window Server 2012R2 on an IIS Version 8.5.9600.16384 web and worked well. Gradually search engine bots found the site and all was well.
This week I went to make some updates to the website and found none of the pictures working. They are all returning a 404 html code. When I view the .jpg files individually from IIS Firefox returns "cannot be displayed because it contains errors". Chrome and Edge both say the file can’t be found. If I view these files from Windows File Explorer they look fine.
So I deleted the files on the server and then copied the published website from my development PC. Still no pictures.
I have another similar web application on the same server so moved one of the jpg files to that directory and tried to view it via IIS – still 404. I copied a picture from the other website to my "broken" directory and the other picture was viewable via IIS. All of these pictures were reduced in the same manner using Photoshop 7.0.
I went back to my development PC and viewed the original website via IIS. The pictures were viewable so I republished the website, copied it to the server – no pictures.
I then found the original picture (not reduced) and moved it to the server. Still 404.
My problem doesn’t seem to be permissions because I can view pictures copied from another web to that directory.
The website had been working for over a year but the pictures now return 404’s.
The pictures can be viewed on the development PC using IIS but not after publishing them and then copying the website to the server.
Another website with essentially the same code with pictures reduced in the same manner is displaying pictures fine.
I’m really perplexed and would love to hear some of your ideas as to what might be my problem. Thanks for taking the time to read this.
3
Answers
I'm pretty sure I figured out the problem but it leads to other questions.
I shortened the filename and now I can browse to it via IIS.
So here are my current questions:
Why had the pictures been browse-able originally but not now? Has there been some kind of internet change about acceptable file length? Or possibly some kind of Server 2012R2 update that caused this change?
Why are these pictures browse-able on my Windows 8.1 PC via IIS but not on the Server 2012R2? I can also open the website and see all of the pictures on Windows 8.1.
It's nice to have tackled one problem but I would still like to know the cause if anyone should have any suggestions.
The first place I always start with missing images is to View Source and make sure the path to the image is actually what I think it is.
Could you have done something so the path is now built relative to the machine’s file structure instead of relative to the site? That could cause the image to be found locally, but not on your server.
It might be easier for someone to get an idea if you included the URL so we could examine the page displayed.
I FINALLY figured out why my pictures disappeared. Yes renaming my .jpg files did fix the problem but that wasn’t the cause. The problem was that I had added /2018, /2019 and /2020 to my IIS Request Filtering denied. All of my picture files had dates on them. When I renamed/shortened the file names I removed the /year. Phew! The stupid things I do! This also explained why I could view these webpages on my development PC but not the server – no request filtering. Hopefully my error helps someone down the line.