Loading Web Project in VS2015 — no styling or images

匆匆过客 提交于 2019-12-11 11:00:04

问题


So I just moved an existing web project over to Visual Studio 2015 Community Edition which I had started back in VS2013 Ultimate and upon running it in the browser all of the styling was missing and no images were showing up. All of the content worked however and I could navigate the site, until I tried to open a picture and I got the error:


HTTP Error 500.19 - Internal Server Error

Config Error Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.woff2'

Config File \?\C:\Users\me\Documents\Visual Studio 2015\Projects......\web.config



回答1:


I realized that I had added the Mimetype to my web.config and apparently now that things run on IIS Express 10.0 it has an error because it already has that Mimetype. I found this solution on a blog which was to simply remove the Mimetype before adding it so as to retain compatibility on older IIS. Here is the relevant web.config section:

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

and voila! Works in IIS 10 now and still works in IIS 8.5



来源:https://stackoverflow.com/questions/32212688/loading-web-project-in-vs2015-no-styling-or-images

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