在IIS中发布后不会呈现BundleConfig

我在服务器的IIS 7中发布我的MVC网站。 当我检查页面源时,我看到我的笔记本电脑没有正确显示。

以下是在IIS服务器中发布后的页面源:

Index - abc System        

以下是我在笔记本电脑上测试时的页面源代码:

  Index - abc System               

以下是BundleConfig.cs的代码:

 public class BundleConfig { // For more information on bundling, visit http://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/jquery").Include( "~/Scripts/jquery-1.10.2.min.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include( "~/Scripts/jquery-ui.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 http://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/respond.js", "~/Scripts/moment.js", "~/Scripts/bootstrap.js", "~/Scripts/bootstrap-datepicker.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/jqueryui/jquery-ui.css", "~/Content/jqsimplemenu.css", "~/Content/bootstrap.css", "~/Content/Site.css", "~/Content/datepicker.css")); } } 

这是我在服务器上发布后页面的结果:

在此处输入图像描述

以下是预期结果:

在此处输入图像描述

页面错误:

在此处输入图像描述

我可以知道如何解决这个问题吗? 谢谢。

试试这个 :

  1. 检查web.config配置并确保将编译调试设置为false

  2. 打开IIS配置 – >validation – >右键单击匿名validation – >单击编辑 – >选择应用程序池标识

在您的web.config中,在节点中添加以下内容。

     

希望这能解决您的问题。

jqueryui一个新包

 bundles.Add(new StyleBundle("~/Content/jqueryui/css") .Include("~/Content/jqueryui/jquery-ui.css")); bundles.Add(new StyleBundle("~/Content/css").Include( // "~/Content/jqueryui/jquery-ui.css", "~/Content/jqsimplemenu.css", "~/Content/bootstrap.css", "~/Content/Site.css", "~/Content/datepicker.css")); 

StyleBundle虚拟路径名称应与项目的文件夹结构匹配。 样式规则可能包含对其他子目录的路径引用,当样式包名称与项目中的物理位置不匹配时,这些引用无法解析。

 .foo { background-image:url('../Images/foo.png'); }