Css 引导图标在本地加载,但联机时不加载

Css 引导图标在本地加载,但联机时不加载,css,image,twitter-bootstrap,azure,twitter-bootstrap-3,Css,Image,Twitter Bootstrap,Azure,Twitter Bootstrap 3,基本上我得到了以下HTML: <button class="disabled btn-primary btn" type="submit" disabled=""> <i class="glyphicon glyphicon-ban-circle"></i> Log in </button> 文件结构如下所示: 此外,bootstrap正在查找以下文件: url('../fonts/glyphicons-halflings-regu

基本上我得到了以下HTML:

<button class="disabled btn-primary btn" type="submit" disabled="">
   <i class="glyphicon glyphicon-ban-circle"></i>
   Log in
</button>
文件结构如下所示:

此外,bootstrap正在查找以下文件:

url('../fonts/glyphicons-halflings-regular.woff') 
bundles.Add(new StyleBundle("~/Content/css").Include(
                "~/Content/css/modern.css",
                "~/Content/css/modern-responsive.css"));

因此,我认为它将在Content文件夹中查找,而不是根目录,因为它当前位于Content/bootstrapcss文件夹中。

我们最近遇到了类似的问题(尽管我们使用的是
metroUI
-)。实际上,我们捆绑了css文件,因此当我们在WindowsAzure中部署应用程序时,没有加载任何字体

在本例中,我们有以下目录结构:

而modern.css引用的字体如下

../fonts/iconFont.eot
我们像这样捆绑css文件:

url('../fonts/glyphicons-halflings-regular.woff') 
bundles.Add(new StyleBundle("~/Content/css").Include(
                "~/Content/css/modern.css",
                "~/Content/css/modern-responsive.css"));
由于捆绑,应用程序在应用程序根目录的
/font
目录中查找字体,但显然不在那里

长话短说,我们最终更改了捆绑包名称:

bundles.Add(new StyleBundle("~/Content/css/metroUI").Include(
                "~/Content/css/modern.css",
                "~/Content/css/modern-responsive.css"));

捆绑包名称更改后,一切都会正常运行。

如果您下载了包含引导图标的theme.zip或theme.rar,请在解压缩之前执行以下操作:

  • 右键单击压缩包
  • 如果“解锁”框可见,请选中该框

要使图标正常工作,我必须将图像所在文件夹的文件夹权限设置为“everyone=read”

更改路径确实有效,但“回答的问题”忽略了一个关键点

如果您使用的是引用捆绑包的
\u Layout.cshtml
,那么这将不再适用于本地和Azure

您还需要更新
\u Layout.cshtml
页面


因此,如果将捆绑包路径从
Content/css
更改为
Scripts/css
,则需要将
\u Layout.cshtml
分别更改为
@style.Render(“~/Scripts/css”)

发布到Azure web服务时,ASP.NET Core 2.0 MVC web app遇到此错误

我的样式表包含在以下代码中

 <environment include="Development">
        <link href="https://fonts.googleapis.com/css?family=Coda" rel="stylesheet">
        <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-blue.min.css" />
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />
 </environment>

简单地将链接复制和粘贴到开发之外的任何环境中都是有效的

<environment exclude="Development">
  <link href="https://fonts.googleapis.com/css?family=Coda" rel="stylesheet">
  <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-blue.min.css" />
  <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
  <link rel="stylesheet" href="~/css/site.css" />
  <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css" asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"
  />
  <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
</environment>


您是否尝试过修改css文件以指向正确的图像?与本地环境相比,您的服务器在所需语法方面会有所不同。你在服务器上的文件夹结构是什么?你是否有可能绑定css文件?@jezzipin我试着将文件夹“字体”添加到根目录中,现在就可以了。但是,现在“字体”文件夹位于根目录和内容目录中。如何从azure中删除文件夹?我已从我的visual studio项目中删除该文件夹并将其发布,但它仍在Azure上。@GauravMantri是的,我看到了。我已经用我的包和文件位置的信息更新了我的问题。我已经像你说的那样得到了,我想——尽管如此,我仍然得到了这个问题。它的引用方式如下:../fonts/glyphicons-halflings-regular.woff,因此我认为它将查找一个文件夹,例如内容文件夹而不是根文件夹。尝试将
~/content/bootstrapcss
更改为
~/content/bootstrapcss/bootstrap
,这应该会有所不同。基本上,当bundled
bootstrapcss
成为应用程序根目录中查找
font
文件夹的
Content
文件夹中的文件名时。如果css文件引用的是像
。/font
这样的字体,它将位于
内容
文件夹上方。添加另一个名称将使css进入
内容
文件夹,然后在那里查找它将找到的
字体
文件夹。@GauravMantri,我的字体文件夹在根目录下,但我仍然有同样的问题。我该怎么办?提前感谢。更改此设置使css无法在本地加载。此解决方案无助于将捆绑包名称机械化!。。。在publish目录中,我看到了“Content”文件夹,应用程序运行正常。谢谢