साइटकोर अभी तक एमवीसी 4 का समर्थन नहीं करता है और मैं System.Web.Optimization के बंडलिंग और न्यूनीकरण का उपयोग करना चाहता हूं।साइटकोर 6.6, एमवीसी 3 और सिस्टम.Web.Optimization?
404 के साथ प्रतिक्रिया देने के लिए बंडलों के अनुरोधों की आवश्यकता नहीं है।
BundleConfig.cs:
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/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 StyleBundle("~/content/css").Include(
"~/Content/site.css",
"~/Content/960.gs/960.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
}
}
_Layout.cshtml: बंडलों को
@using System.Web.Optimization
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div class="container_12">
<a href="/"><h1>Title</h1></a>
@Html.Action("Utilities", "Navigation")
@Html.Action("Menu", "Navigation")
@RenderBody()
</div>
@Scripts.Render("~/bundles/jquery")
@RenderSection("scripts", required: false)
</body>
</html>
पथ आभासी हैं और शारीरिक फ़ोल्डरों को मैप नहीं है।
की उपेक्षा मार्गों एक NotImplementedException और 500 आंतरिक सर्वर त्रुटि फेंकता है:
routes.IgnoreRoute("content/{*pathInfo}");
routes.IgnoreRoute("bundles/{*pathInfo}");
.. लेकिन अन्यथा, अनुरोध Sitecore द्वारा नियंत्रित किया जाता है और एक 404 नहीं मिला + पुनर्निर्देशन के साथ प्रतिक्रिया कर रहे हैं।
मैं भी कोशिश की है:
<system.webServer>
<modules runAllManagedModulesForAllRequests="false">
<remove name="BundleModule"/>
<add type="System.Web.Optimization.BundleModule" name="BundleModule"/>
</modules>
मैं यह सब नहीं मिल एक साथ काम कर सकते हैं। मदद!
मुझे डर है कि साइटकोर को बंडलों को संभालने से पहले सभी मार्गों को पकड़ने के लिए परिभाषित किया जा सकता है ... – maxbeaudoin