简体   繁体   中英

Loading Web Project in VS2015 — no styling or images

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


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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM