我們最近將項目從MVC 3升級到了MVC 4.我們的目標是.NET 4.0框架,我們的Web應用程序是32位由於我們必須包括一些參考。64位IIS 7.5服務器上的ASP.NET/MVC 4捆綁和縮小404問題
我們遇到的問題是,我們將捆綁/縮小從Chirpy轉換爲內置ASP.NET捆綁。該網站在運行ONLY .NET 4.0的32位服務器,Windows Server 2003/IIS 6和2008/IIS 7.5以及我們的64位開發計算機上都沒有問題。上述所有捆綁/縮小工作都很好。
在安裝了ONLY .NET 4.0的64位Windows 2008/IIS 7.5服務器上,捆綁不起作用。我們爲生成的腳本和樣式獲取了404錯誤。
如果我們在64位服務器上安裝.NET 4.5,它工作正常。我們對此感到困惑,因爲有些服務器在沒有.NET 4.5的情況下工作,而這需要它。最重要的是,Windows Server 2003/64位與.NET 4.5不兼容,所以如果出現問題,此修補程序將不起作用。
奇怪的是,以.NET 4.0爲基礎構建x86的示例MVC 4示例互聯網應用在問題服務器上工作正常,只有4.0。 web.config除了統一,日誌記錄,elmah和無點配置以外完全相同。
任何幫助,這將不勝感激。
這裏的BundleConfig.cs:
using System.Web;
using System.Web.Optimization;
namespace WebApp
{
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.UseCdn = false;
// .debug.js, -vsdoc.js and .intellisense.js files
// are in BundleTable.Bundles.IgnoreList by default.
// Clear out the list and add back the ones we want to ignore.
// Don't add back .debug.js.
bundles.IgnoreList.Clear();
bundles.IgnoreList.Ignore("*-vsdoc.js");
bundles.IgnoreList.Ignore("*intellisense.js");
bundles.Add((new ScriptBundle("~/bundles/WebApp.Register1")).Include("~/Scripts/jquery.ba-tinypubsub.min.js",
"~/Scripts/knockout-2.1.0.js",
"~/Scripts/WebApp/WebApp.Register.RegisterStudent.js",
"~/Scripts/WebApp/WebApp.Register.RegisterPresenter.js"));
bundles.Add((new Bundle("~/bundles/WebApp.Register2")).Include("~/Scripts/WebApp/WebApp.Register.StudentSelect.js"));
bundles.Add((new ScriptBundle("~/bundles/WebApp.View1")).Include("~/Scripts/jquery.ba-tinypubsub.min.js",
"~/Scripts/WebApp/WebApp.View.ImagePresenter.js",
"~/Scripts/WebApp/WebApp.View.ImageResults.js"));
bundles.Add((new Bundle("~/bundles/WebApp.View2")).Include("~/Scripts/WebApp/WebApp.View.StudentsSelect.js"));
bundles.Add((new ScriptBundle("~/bundles/WebApp.Print1")).Include("~/Scripts/WebApp/WebApp.Print.SelectedIdArray.js",
"~/Scripts/jquery.ba-tinypubsub.min.js",
"~/Scripts/WebApp/WebApp.Print.DocumentsSelect.js",
"~/Scripts/WebApp/WebApp.Print.DocumentsSelected.js",
"~/Scripts/WebApp/WebApp.Print.DocumentsPresenter.js",
"~/Scripts/WebApp/WebApp.Print.StudentsPresenter.js",
"~/Scripts/WebApp/WebApp.Print.PrinterSelected.js",
"~/Scripts/WebApp/WebApp.Print.OutputSummary.js",
"~/Scripts/WebApp/WebApp.Print.OutputPresenter.js",
"~/Scripts/WebApp/WebApp.Print.NoStudentPresenter.js"));
bundles.Add((new Bundle("~/bundles/WebApp.Print2")).Include("~/Scripts/WebApp/WebApp.Print.StudentsSelect.js",
"~/Scripts/WebApp/WebApp.Print.StudentsSelected.js"));
bundles.Add((new ScriptBundle("~/bundles/WebApp.Main")).Include("~/Scripts/modernizr.custom.33607.js",
"~/Scripts/jquery-1.6.1.js",
"~/Scripts/jquery-ui-1.8.10.custom.min.js",
"~/Scripts/jquery-ui.min.js",
"~/Scripts/json.js",
"~/Scripts/jquery.validate.min.js",
"~/Scripts/jquery.marquee.js",
"~/Scripts/YUI.js",
"~/Scripts/Common.SearchHighlight.js"));
bundles.Add((new StyleBundle("~/bundles/Content/WebApp.Main")).Include("~/Content/jquery.marquee.min.css",
"~/Content/YUI.css",
"~/Content/Site.css",
"~/Content/ui-lightness/jquery-ui-1.8.10.custom.css"));
}
}
}
下面是我們如何引用我們的佈局包:
@Scripts.Render("~/bundles/WebApp.Main")
<link href="@Url.Content("~/Content/SiteLess.less")" rel="stylesheet" type="text/css" />
@Styles.Render("~/bundles/Content/WebApp.Main")
...
編輯:響應/更新
- 是的,已啓用的32位應用程序標誌在應用程序池中設置爲True。
- 來,讓404看起來像這樣http://xx.xx.xx.xxx/WebApp/bundles/WebApp.Main?v=03pBc7hdH1lHLtZGx-JMosNaLpMK7fcmI0uI6auknHw1
- Windows事件查看器請求的路徑顯示什麼
- 它可以安裝.NET 4.5,卸載它,然後再重新安裝後.NET 4.0
- 它的工作原理上的企業2008 64位服務器。問題服務器是標準版。我們將重建虛擬機以查看是否解決了這個問題。
這可能有助於http://forums.asp.net/t/1846749.aspx/2/10?Published+MVC+web+to+IIS7+in+Windows+Server+2008+doesn+t+serve+捆綁 – Jack 2013-02-21 23:41:09
發佈您的BudleConfig.cs請 – CrazyCoderz 2013-02-22 11:57:04
@Jack謝謝,我們通讀了該主題,並提出了更改建議,但它沒有幫助。在64位機器上安裝.NET 4.0和.NET 4.5後,Ours實際上可以正常工作。我不認爲.NET 4.5是必需的。 – Dustin 2013-02-22 14:03:25