Images under wwroot folder throwing 404 not found error in ASP.NET core after published in IIS but working in local

56 Views Asked by At

In local images are loaded properly without any issue but after published the code in IIS I am facing 404 resource not found error but in server I can able to see the images under wwwroot folder even css files under wwwroot folder working fine in both local and published site facing this issue for images alone. I ensured mime type configuration in IIS for png images also.

ErrorMessage

1

There are 1 best solutions below

4
YurongDai On

If you get a 404 error when accessing the IIS page, but the image file exists on the server. Please check the windows features to make sure "Static Content" is installed. The "Static Content" service is responsible for serving static content such as images, scripts, stylesheet files, etc. This is a feature that must be explicitly enabled on the server.

Without this functionality, IIS will not be able to serve static files, and clients will receive errors or be unable to retrieve static resources.

enter image description here