2015-08-27 10 views
7

Ich führe Sitecore 8 (Update 5) auf .NET 4.6 aus und stoße auf ein Problem mit Bundles, die einen 404-Fehler zurückgeben.Sitecore 8, .NET 4.6, zurückgegebene Bundles 404

Mein Layout-Ansicht:

@using Sitecore.Mvc.Presentation 
@using Sitecore.Mvc 

@model RenderingModel 

    <!DOCTYPE html> 
    <html> 
    <head> 
     <meta name="viewport" content="width=device-width" /> 
     <title>@Model.Item.Fields["Title"]</title> 
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> 
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> 
    </head> 
    <body> 
     <h1>@Html.Sitecore().Field("Title")</h1> 
     @Html.Sitecore().Placeholder("content") 

     <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script> 
     <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js" type="text/javascript" defer="defer"></script> 
     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 
     @Scripts.RenderFormat("<script type=\"text/javascript\" src=\"{0}\" defer=\"defer\"></script>", "~/bundles/scripts/footer") 
    </body> 
    </html> 

Mein /Global.asax.cs Datei:

using System.Web.Mvc; 
using System.Web.Optimization; 
using Glass.Mapper.Sc; 

namespace Sitecore.Web 
{ 
    public class MvcApplication : System.Web.HttpApplication 
    { 
     protected void Application_Start() 
     { 
      AreaRegistration.RegisterAllAreas(); 
      BundleConfig.RegisterBundles(BundleTable.Bundles); 
     } 

     protected void Application_BeginRequest() 
     { 
      Sitecore.Context.Items["Disable"] = new VersionCountDisabler(); 
     } 
    } 
} 

Mein /App_Start/BundleConfig.cs Datei:

using System.Web.Optimization; 

public class BundleConfig 
{ 
    public static void RegisterBundles(BundleCollection bundles) 
    { 
     bundles.Add(new ScriptBundle("~/bundles/scripts/footer").Include(
      "~/Assets/js/jquery.validate.js", 
      "~/Assets/js/additional-methods.js", 
      "~/Assets/js/form.js", 
      "~/Assets/js/marketo.js" 
     )); 


     #if DEBUG 
      BundleTable.EnableOptimizations = false; 
     #else 
      BundleTable.EnableOptimizations = true; 
     #endif 
    } 
} 

Der <system.webServer>/modules Abschnitt meiner /Web.config:

<modules runAllManagedModulesForAllRequests="true"> 
    <remove name="WebDAVModule" /> 
    <add type="Sitecore.Web.RewriteModule, Sitecore.Kernel" name="SitecoreRewriteModule" /> 
    <add type="Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus" name="SitecoreHttpModule" /> 
    <add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel" name="SitecoreUploadWatcher" /> 
    <add type="Sitecore.IO.XslWatcher, Sitecore.Kernel" name="SitecoreXslWatcher" /> 
    <add type="Sitecore.IO.LayoutWatcher, Sitecore.Kernel" name="SitecoreLayoutWatcher" /> 
    <add type="Sitecore.Configuration.ConfigWatcher, Sitecore.Kernel" name="SitecoreConfigWatcher" /> 
    <remove name="Session" /> 
    <add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" /> 
    <add type="Sitecore.Analytics.RobotDetection.Media.MediaRequestSessionModule, Sitecore.Analytics.RobotDetection" name="MediaRequestSessionModule" /> 
    <add type="Sitecore.Web.HttpModule,Sitecore.Kernel" name="SitecoreHttpModuleExtensions" /> 
    <add name="SitecoreAntiCSRF" type="Sitecore.Security.AntiCsrf.SitecoreAntiCsrfModule, Sitecore.Security.AntiCsrf" /> 
    <remove name="BundleModule"/> 
    <add type="System.Web.Optimization.BundleModule" name="BundleModule"/> 
</modules> 

Und schließlich die IgnoreUrlPrefixes, indem sie als angezeigte Einstellung /sitecore/admin/showconfig.aspx, das zeigt,/Bündel ist in der Liste enthalten:

<!-- 
    IGNORE URLS 
      Set IgnoreUrlPrefixes to a '|' separated list of url prefixes that should not be 
      regarded and processed as friendly urls (ie. forms etc.) 

--> 
<setting name="IgnoreUrlPrefixes" value="/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing|/bundles|/Assets"/> 

UPDATE: Siehe akzeptierte Antwort unten.

+0

Ich glaube nicht, dass Sitecore noch für 4.6 bereit ist. Habe noch keine Regressionstests durchgeführt. 8.0 ist gerade mit 4.5 und mvc 5.2 erschienen. Wahrscheinlich wird es etwas früher sein, bevor 4.6 gedrängt wird (oder zumindest bis es unterstützt wird). –

+0

Ich habe das Build-Ziel auf 4,5 geändert und das gleiche Verhalten tritt auf. Die 404-Fehlerseite zeigt an, dass der Handler StaticFile ist, was für mich falsch wäre. –

Antwort

2

Ich entdeckte, was das Problem war. Das Attribut "Erben" des Markups meines Global.asax stimmte nicht mit dem Klassennamen in Global.asax.cs überein.

+0

Tricky. Ich möchte WebActivatorEx als Alternative zum Ändern des Global.asax verwenden. –

0

Zeit zu experimentieren:

  1. Ihre Compiler-Direktiven entfernen. <compilation debug="true|false"> sollte dies zur Laufzeit kontrollieren.
  2. Entfernen Sie Ihre web.config <module> Einträge. Ich habe festgestellt, dass dies nicht einmal für Sitecore 7.2-Projekte erforderlich war.
+0

Versuchte diese. Keine Änderung im Verhalten. –

+0

Kein physischer Ordner namens/Bundles auf der Festplatte? –

+0

Kein physischer Ordner namens/Bundles auf der Festplatte. –

Verwandte Themen