0

我在 VS2012 RC 上开发了 MVC 4 Web 应用程序,可以在本地机器上完美运行。但不幸的是,在运行 IIS8 的 Windows Server 2012 上丢失了所有样式和 JS 链接。我通过以下方式在 App_Start/BundleConfig.cs 中使用捆绑:

bundles.Add(new StyleBundle("~/Content/themes/brain/css").Include(
                       "~/Content/themes/brain/css/colorpicker.css",
                       "~/Content/themes/brain/css/dataTable.css",
                       "~/Content/themes/brain/css/elfinder.css",
                       "~/Content/themes/brain/css/fullcalendar.css",
                       "~/Content/themes/brain/css/icons.css",
                       "~/Content/themes/brain/css/main.css",
                       "~/Content/themes/brain/css/prettyPhoto.css",
                       "~/Content/themes/brain/css/reset.css",
                       "~/Content/themes/brain/css/ui_custom.css",
                       "~/Content/themes/brain/css/wysiwyg.css"));

开发机器Chrome浏览器按照以下方式呈现它并且一切正常:

<link href="/Content/themes/brain/css/reset.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/colorpicker.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/dataTable.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/elfinder.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/fullcalendar.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/icons.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/main.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/prettyPhoto.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/ui_custom.css" rel="stylesheet" type="text/css">
<link href="/Content/themes/brain/css/wysiwyg.css" rel="stylesheet" type="text/css">

但是当我在 Windows Server 2012 上部署该 MVC 4 Web 应用程序时,它会丢失所有样式,并且呈现的 URL 更改为以下内容:

<link href="/Content/themes/brain/css?v=GrnUd5kGfttlbxsKkSshjvQMYvod-OnNzUX71bmBRPk1" rel="stylesheet" type="text/css">

请告知是否有人知道解决方案

4

1 回答 1

-1

页面是否在服务器上正确呈现?这似乎按预期工作。在您的开发机器上,您的 web.config 中可能有。当此标志设置为 false(或丢失)时,即在部署到您的服务器之后,它会打开优化并进行捆绑/缩小。

于 2013-02-21T22:56:03.430 回答