5

I have multiple images but i have changed the extension for my own purpose. So I have multiple extension. When I try to display my image I got an error that my extension is not mapped to a mime type. So how can I display my image without changing the extension because I have a lot. With Apache wamp server I tested all images and it can be displayed.

Then with IIS express included within visual studio 2017, is there a way to do the mapping. I also did the mapping individually but this cannot be good solution for me because I have many images file.

2 Answers 2

11

You can change the config file that IIS express use it:

  1. Right click on IIS Express icon on traybar then click on "Show All Application"

open config file

  1. Select your application name and click on config address in bottom of application list.

open config file

  1. Opened file contains xml elements. you must find "staticConten" element then add your intended mapping.

enter image description here

2
  • This does not work. The config file is locked so I cannot edit it. If I stop the server, the config file is deleted, so I cannot edit it. Jun 4, 2021 at 16:09
  • @JohnHenckel the file isn't deleted in my machine. I followed the steps above, but once I had the file open and before editing it I stopped the execution of the app, then I edited the file and then I re-ran the app and it worked perfectly. Jun 23, 2021 at 18:30
1

If you run iisexpress.exe from the command line, the config file it uses will be in AppServer/applicationhost.config. Add the mime types you need to that file in the section <staticContent> and restart iisexpress.

1
  • 1
    You just ended a day's worth of suffering for me, thank you so much for this answer. I've added mime types everywhere but in this file, and nothing worked. Jul 15, 2022 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.