发布到IIS后样式/脚本中断

时间:2014-03-03 16:35:21

标签: asp.net asp.net-mvc-4 iis visual-studio-2013

我的ASP.Net MVC 4网站在Visual Studio 2013中运行良好,但是,在部署的预设中,我试图“发布”到我的本地IIS实例,而我的样式/脚本包似乎不是工作

我在IIS中设置了一个新网站:

IIS Config

并在visual studio中创建了一个发布配置文件:

Visual Studio Publish Profile

但看起来某些事情没有正确执行。

工作主页源示例(在visual studio中运行时)

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Home Page - My ASP.NET Application</title>

    <link href="/Content/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/Content/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/Content/css/animate.min.css" rel="stylesheet"/>
    <link href="/Content/css/lightbox.css" rel="stylesheet"/>
    <link href="/Content/css/syntax/shCore.css" rel="stylesheet"/>
    <link href="/Content/css/syntax/shThemeDefault.css" rel="stylesheet"/>
    <link href="/Content/css/color-default.css" rel="stylesheet"/>
    <link href="/Content/css/width-full.css" rel="stylesheet"/>
    <link href="/Content/css/style.css" rel="stylesheet"/>

    <link href="/Content/css/LESS/lba.less" rel="stylesheet"/>

    <script src="/Scripts/modernizr-2.6.2.js"></script>

非工作主页源样本(来自IIS)

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Home Page - My ASP.NET Application</title>

    <link href="/Content/css?v=KKy3Sm_C-GIW_Hs_Kz3iGW2JCKsc0-x42GPtfoGzMKs1" rel="stylesheet"/>

    <link href="/Content/css/LESS?v=V3zOrniKjzcAwQn95ck_IGMcC8gvUmcHC3PpOi1mL_M1" rel="stylesheet"/>

    <script src="/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script>

作为一些最终信息 - 链接/路由似乎正在工作(即当我点击链接时页面加载)。

更新1

_Layout.cshtml的相关部分

 @Styles.Render("~/Content/css")
 @Styles.Render("~/Content/css/LESS")
 @Scripts.Render("~/bundles/modernizr")

BundleConfig.cs

namespace Lubbock_Baseball_Academy
{
    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/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/bootstrap.js",
                      "~/Scripts/respond.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/css/bootstrap.min.css",
                      "~/Content/css/font-awesome.min.css",
                      "~/Content/css/animate.min.css",
                      "~/Content/css/lightbox.css",
                      "~/Content/css/syntax/shCore.css",
                      "~/Content/css/syntax/shThemeDefault.css",
                      "~/Content/css/color-default.css",
                      "~/Content/css/width-full.css",
                      "~/Content/css/style.css"));

            bundles.Add(new ScriptBundle("~/bundles/theme").Include(
                       "~/Scripts/jquery-1.10.2.min.js",
                       "~/Scripts/jquery.cookie.js",
                       "~/Scripts/bootstrap.min.js",
                       "~/Scripts/jquery.mixitup.min.js",
                       "~/Scripts/lightbox-2.6.min.js",
                       "~/Scripts/holder.js",
                       "~/Scripts/app.js"));


            bundles.Add(new LessBundle("~/Content/css/LESS").Include(
                        "~/Content/css/LESS/*.less"));
        }
    }
}

0 个答案:

没有答案
相关问题