我在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">
请告知是否有人知道解决方案
答案 0 :(得分:-1)
页面是否在服务器上正确呈现?这似乎按预期工作。在您的开发机器上,您可能在web.config中。当此标志设置为false(或丢失)时,即在部署到服务器之后,它会打开优化并发生捆绑/缩小。