500 Internal Server Error requesting any resource files (css, js, images) in an .Net MVC 3 site

元气小坏坏 提交于 2019-12-01 04:10:13

I was getting the same error when I published my site from local (Windows 7) to the server (Windows 2012).

My Local IIS had added this code:

<staticContent>
  <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
  <mimeMap fileExtension=".woff2" mimeType="application/x-font-woff" />
</staticContent>

Where as I needed this on Win 2012

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

It seems the newer version of IIS on Win2012 already has .woff added and instead of giving me any kind of details, it just went 500!

As mentioned in my edits. The problem was an incorrect IIS setting that I found with the IIS 6 Metabase Explorer.

I used IIS 6 Metabase explorer (yes I used it on IIS 8 site) and saw quite a few entries that were not in the working site. After deleting one by one, I found it was the "scriptMaps" entry that was being added during our MSI install causing a problem. This was added to automatically add wildcard mappings during install. It works on IIS6, but apparently not on IIS8.

I am not sure why the files would get served up properly on the first request, but not subsequent requests, but removing the entry worked. I could not find the "ScriptMaps" setting anywhere in the IIS GUI, but it is probably there somewhere.

To my situation, I met this error when running my application on Window 8.0.

After I changed the mini type of .woff from 'font/x-woff' to 'application/x-font-woff' in IIS, it works well.(after I changed the mini type, my web config added '' into staticContent automatically)

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