Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding <mimeMap> entry Causes 500 for Other Static Content on IIS Express

I'm using Visual Studio 2012 with Update 2 and IIS Express.

When I add a record to the staticContent section, all other static content (.js, .css, .jpg, etc) returns a 500 error.

Any advice would be greatly appreciated. Thanks in advance.

like image 313
Aaron Drenberg Avatar asked Apr 24 '13 20:04

Aaron Drenberg


People also ask

What is MimeMap?

The MimeMap property provides a list of the file name extensions for Multipurpose Internet Mail Extensions (MIME) mappings.

How do you add an explicit mime map?

In the Connections pane, go to the site, application, or directory for which you want to add a MIME type. In the Home pane, double-click MIME Types. In the MIME Types pane, click Add... in the Actions pane. In the Add MIME Type dialog box, add the file name extension and MIME type, and then click OK.

What is MIME type in IIS?

If IIS does not recognize the file name extension requested by the client, IIS sends the content as the default MIME type, which is Application. This MIME type signifies that the file contains application data, and it usually means that clients cannot process the file.

How do I change the MIME type of a file in Windows?

Windows makes it very convenient to associate programs and file type Right click the file and open up properties. From here, under the general tab, you can choose which app opens this specific file type. Hit change, and navigate to your shim.


2 Answers

The mimetype is probably already added to your IIS.

Try to remove the mimetype first and then add it again in your web.config

<remove fileExtension=".woff"/>
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />

Good luck!

like image 60
Madelene Avatar answered Oct 11 '22 09:10

Madelene


Behavior of system.webServer/staticContent/mimeMap element has changed in IIS 7.0 and apparently one has to list all types explicitly to have them returned properly.

Here is a description from IIS configuration documentation:

Note: IIS 7 will not return file types that are not added to the element or that have mappings in the element by default. This behavior prevents unauthorized access to files that do not have mappings in the IIS 7 configuration settings.

like image 31
Tomasz Poradowski Avatar answered Oct 11 '22 10:10

Tomasz Poradowski