在IIS中发布后不会呈现BundleConfig [英] BundleConfig not rendered after publish in IIS
问题描述
我在服务器中的IIS 7中发布了我的MVC网站。当我检查页面源代码时,我看到我的笔记本电脑没有正确显示。
I publish my MVC website in IIS 7 in the server. When i check the page source, i see is not rendered correctly like in my laptop.
以下是IIS服务器发布后的页面源:
Here are the page source after publish in IIS server:
<title>Index - abc System</title>
<link href="/Content/css?v=_rLk6cMaTu8NrnGsCcMX7zjA8m5GS5kIRuTA39lx1hA1" rel="stylesheet"/>
<script src="/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script>
<script src="/bundles/jquery?v=FVs3ACwOLIVInrAl5sdzR2jrCDmVOWFbZMY6g6Q0ulE1"></script>
<script src="/bundles/bootstrap?v=Powlo484qpYf7E94XNxyY8F7N2GFx0uTQqXYUc9P62E1"></script>
<script src="/bundles/jqueryui?v=ZtBSbUDKlnEJoTEt91W1Sw3Wm7_cMVUFkutTVjnNqLk1"></script>
<!-- Script for menu -->
<script src="/Scripts/jqsimplemenu.js" type="text/javascript"></script>
以下是我在笔记本电脑上测试时的页面来源:
Here are the page source when i test it in my laptop:
<title>Index - abc System</title>
<link href="/Content/jqueryui/jquery-ui.css" rel="stylesheet"/>
<link href="/Content/jqsimplemenu.css" rel="stylesheet"/>
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/Site.css" rel="stylesheet"/>
<link href="/Content/datepicker.css" rel="stylesheet"/>
<script src="/Scripts/modernizr-2.6.2.js"></script>
<script src="/Scripts/jquery-1.10.2.min.js"></script>
<script src="/Scripts/respond.js"></script>
<script src="/Scripts/moment.js"></script>
<script src="/Scripts/bootstrap.js"></script>
<script src="/Scripts/bootstrap-datepicker.js"></script>
<script src="/Scripts/jquery-ui.js"></script>
<!-- Script for menu -->
<script src="/Scripts/jqsimplemenu.js" type="text/javascript"></script>
以下是BundleConfig.cs的代码:
Here are the code for 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"));
}
}
这是我在服务器上发布后的页面结果:
Here the result of the page after i publish in server:
以下是预期结果:
页面错误:
我可以知道如何解决此问题?谢谢。
Can i know how to resolve this issue? Thanks.
推荐答案
试试这个:
-
检查您的web.config配置并确保编译调试设置为false
Check your web.config configuration and make sure compilation debug is set to false
打开IIS配置 - >验证 - >右键单击匿名验证 - >单击编辑 - >选择应用程序池标识
Open IIS Config -> Authentication -> right click on Anonymous Auth ->Click Edit -> Choose Application pool identity
这篇关于在IIS中发布后不会呈现BundleConfig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!