【发布时间】:2014-01-01 00:21:53
【问题描述】:
--- 注意:转到 EDITED 2 部分进行总结----
我有一个 ASP.NT MVC (4) 应用程序。我将 (twitter)Bootstrap 集成到它。 Bootstrap 运行良好,但在我发布应用程序时图标显示不正确。
我尝试重新发布应用程序但没有成功。
为了澄清,我在下面放了一些图片。
当我从 VS2013 运行我的应用程序时,结果是这样的(没关系):
在展位,IE 和 Chrome。
但是当我运行已发布的应用程序时,结果是这样的(这是不行的):
- 铬
- IE (10)
不知何故,这个问题与评估的 CSS 相关,但我不知道这会在什么时候发生。
本地应用程序中评估的 css 是这样的(没关系):
- 铬
- IE
但在已发布的应用程序中,我有这个(这是不行的):
- 铬:
- IE:
有些人经历过这种行为?
我能做些什么来解决这个奇怪的问题?
--------------- 已编辑 ------------------- ------------
在发布我的应用程序时,我得到了要包含的字体文件(.eot、.svg、.ttf 和 .woff)。
当我访问默认页面(应用程序根 http://localhost/)时,该页面显示了 Chrome 的开发者工具网络选项卡中显示的文件的图标:
在包含文件之前,我收到了文件的 404 错误,所以我猜想它们会继续被请求,即使它们没有显示在“网络”选项卡中。
不过,图标显示不正确。
------------ 已编辑 2 --------- ------
好吧,我在 IIS 7 中重新启动我的站点。请求开始被触发。这些是 Chrome 的开发者工具网络选项卡中显示的文件请求:
resquest 然后在:/Content/themes/fonts/ 中查找文件,但它们位于:/Content/themes/base/fonts/
base 文件夹包含一个 bootstrap 文件夹,其中包含 bootstrap.css 文件。在 CSS 文件中有这个类引用字体文件:
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../fonts/glyphicons-halflings-regular.eot');
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
}
似乎对字体文件的引用很好,因为文件树是这样的:
我可以将班级更改为:
@font-face {
font-family: 'Glyphicons Halflings';
src: url('../base/fonts/glyphicons-halflings-regular.eot');
src: url('../base/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../base/fonts/glyphicons-halflings-regular.woff') format('woff'), url('../base/fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../base/fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');
}
但是,我实际上会知道发生了什么以及如何解决它! 此外,图标将显示在已发布的站点中,但不会显示在本地站点中(从 VS2013 和 iisexpress 运行)。 提前感谢您的帮助!
【问题讨论】:
-
我正在为更具体的问题创建另一个答案,即为什么在发布应用程序时没有复制文件
-
IIS 7. 我重新启动站点,然后显示请求:问题是请求查找文件
/Content/themes/fonts/glyphicons-halflings-regular.*,但文件位于:/Content/themes/base/fonts/glyphicons-halflings-regular.* -
实际上这解决了我的问题stackoverflow.com/questions/12458444/…
标签: css asp.net-mvc asp.net-mvc-4 twitter-bootstrap less