简体   繁体   English

在VS2015中加载Web项目-无样式或图像

[英]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. 因此,我只是将现有的Web项目移到了我从VS2013 Ultimate开始的Visual Studio 2015社区版中,在浏览器中运行它时,所有样式都丢失了,没有图像显示出来。 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 HTTP错误500.19-内部服务器错误

Config Error Cannot add duplicate collection entry of type 'mimeMap' with unique key attribute 'fileExtension' set to '.woff2' 配置错误无法添加唯一键属性“ fileExtension”设置为“ .woff2”的类型“ mimeMap”的重复收集条目

Config File \\?\\C:\\Users\\me\\Documents\\Visual Studio 2015\\Projects......\\web.config 配置文件\\?\\ 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. 我意识到我已经将Mimetype添加到了我的web.config中,并且显然现在在IIS Express 10.0上运行的东西有一个错误,因为它已经具有该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. 在博客上找到了此解决方案,该解决方案是在添加Mimetype之前先将其删除,以保持与旧版IIS的兼容性。 Here is the relevant web.config section: 这是相关的web.config部分:

<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 现在可以在IIS 10中使用,并且仍然可以在IIS 8.5中使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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