Bootstrap Icons not showing in published ASP.NET MVC application

后端 未结 17 2161
孤城傲影
孤城傲影 2021-01-30 11:30

--- NB: Go to the EDITED 2 section for summary ----

I have an ASP.NT MVC (4) application. I integrated (twitter)Bootstrap to it. Bootstrap is working perfectly, but the

17条回答
  •  时光取名叫无心
    2021-01-30 11:46

    If your bundling your scripts and CSS then assets like images may not be found.

    In your BundleConfig.cs file, create your bundle with CssRewriteUrlTransform:

    bundles.Add(new StyleBundle("~/Content/css/bootstrap").Include("~/Content/bootstrap.min.css", new CssRewriteUrlTransform()));
    

    Include in _Layout.cshtml:

    @Styles.Render("~/Content/css/bootstrap")
    

    Everything should be good. And yes, viewing what's happening over the network to see what URL is generating the 404s will help.

    EDIT: Ensure you are using Microsoft.AspNet.Web.Optimization v1.1.0. Confirmed version 1.1.3 causes this error as well.

提交回复
热议问题