MVC应用程序布局发布到IIS与从Visual Studio运行时的布局不同

时间:2019-04-02 00:31:16

标签: asp.net-mvc iis asp.net-mvc-5 iis-10

我是MVC的新手,请多多包涵。从Visual Studio(右)运行时,与发布到IIS(左)时,如何使MVC应用看起来相同?特别是,顶部显示“ MVC电影”的导航栏。 network tab sources tab styles side-by-side comparison content/css

BundleConfig.cs

using System.Web;
using System.Web.Optimization;

namespace MvcMovie
{
    public class BundleConfig
    {
        // For more information on bundling, visit https://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js"));

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

1 个答案:

答案 0 :(得分:0)

enter image description here因此,它确实是Bootstrap的NuGet更新。缺少的样式在def parse(self, response): for product_item in response.css('li.product-item'): url = "https://www2.hm.com/" + product_item.css('a::attr(href)').extract_first() yield scrapy.Request(url=url, callback=self.parse_subpage) def parse_subpage(self, response): item = { 'title': response.xpath("normalize-space(.//h1[contains(@class, 'primary') and contains(@class, 'product-item-headline')]/text())").extract_first(), 'sale-price': response.xpath("normalize-space(.//span[@class='price-value']/text())").extract_first(), 'regular-price': response.xpath('//script[contains(text(), "whitePrice")]/text()').re_first("'whitePrice'\s?:\s?'([^']+)'"), 'photo-url': response.css('div.product-detail-main-image-container img::attr(src)').extract_first(), 'description': response.css('p.pdp-description-text::text').extract_first() } yield item 文件中。让我兴奋的是所需外观的Chrome缓存。我已经将引导程序恢复到3.3.7,一切正常。抱歉给你带来不便。您可以根据需要删除整个线程。