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

倾然丶 夕夏残阳落幕 提交于 2019-11-29 02:10:28

问题


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.


回答1:


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!




回答2:


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.




回答3:


If you are using IIS Express in visual studio then there is no need to define staticContent so remove it.

By default, Visual studio IIS Express allow all MIME types.



来源:https://stackoverflow.com/questions/16201406/adding-mimemap-entry-causes-500-for-other-static-content-on-iis-express

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!