在azure上发布我的Web应用程序

时间:2015-12-14 21:46:25

标签: asp.net-mvc azure

为什么当我在Azure上发布我的网络应用时,它已经搞砸了

http://websitetest111.azurewebsites.net/
在我的本地主机上,它运行得很好!? 这是BundleConfig的代码:

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/custom").Include(
                        "~/Scripts/jquery.prettyPhoto.js",
                        "~/Scripts/main.js",
                        "~/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.css",
                        "~/Content/css/font-awesome.min.css",
                        "~/Content/css/prettyPhoto.css",
                        "~/Content/css/animate.css",
                        "~/Content/css/main.css"));
        }
    }

以及我在_layout.cshtml中使用它的地方:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Home | Flat Theme</title>
    @*@Scripts.Render("~/bundles/jquery")*@
    @Scripts.Render("~/bundles/custom")
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/bootstrap")
    @Scripts.Render("~/bundles/modernizr")

    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
    <link rel="shortcut icon" href='@Url.Content("/Content/images/ico/favicon.ico")'>
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href='@Url.Content("/Content/images/ico/apple-touch-icon-144-precomposed.png")'>
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href='@Url.Content("/Content/images/ico/apple-touch-icon-114-precomposed.png")'>
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href='@Url.Content("/Content/images/ico/apple-touch-icon-72-precomposed.png")'>
    <link rel="apple-touch-icon-precomposed" href='@Url.Content("/Content/images/ico/apple-touch-icon-57-precomposed.png")'>
</head><!--/head-->
<body>

这有什么问题?

1 个答案:

答案 0 :(得分:0)

您的CSS包似乎已被破坏:

enter image description here

可能是因为在将您的网站发布到Azure时,您的构建处于发布模式。

您可以分享您的捆绑配置以获得更清晰的答案......

更新:

查看Debug版本后,看起来你的Bootstrap的Css路径是错误的:

<link href="/Content/css/bootstrap.min.css" rel="stylesheet"> <link href="/Content/css/font-awesome.min.css" rel="stylesheet"> <link href="/Content/css/prettyPhoto.css" rel="stylesheet"> <link href="/Content/css/animate.css" rel="stylesheet"> <link href="/Content/css/main.css" rel="stylesheet">