0

Ich habe versucht, Sitecore 8.2 MVC einzurichten und das MVC-Bundle zu verwenden, um alle meine Skripte und Stile auf das Hauptlayout zu übertragen. Ich habe Probleme, seit die globale Datei nicht mehr verwendet wird und Best Practices Ich sollte den buldler mit der Pipeline initialisieren.Sitecore 8.2 MVC kann MVC-Bundles nicht zum Laufen bringen

BundleConfig.cs

using System.Web; 
using System.Web.Optimization; 
using Sitecore; 
using Sitecore.Pipelines; 

namespace MySite.Web.Pipelines 
{ 

    public class RegisterPlatformBundles 
    { 
     [UsedImplicitly] 
     public virtual void Process(PipelineArgs args) 
     { 
      RegisterBundles(BundleTable.Bundles); 
     } 
     private void RegisterBundles(BundleCollection bundles) 
     { 
      bundles.Add(new StyleBundle("~/bundles/styles").Include(
         "~/Content/bootstrap.css", 
         "~/Content/site.css")); 

     } 

    } 

Ich habe versucht, es in die Pipeline-Datei withthe folgende Konfiguration hinzuzufügen.

Ich bekomme den folgenden Fehler, wenn ich versuche, die Website auszuführen. Jeder Rat oder auch nur der richtige Weg, um mir dabei helfen zu können, wäre großartig. Vielen Dank.

Could not resolve type name: MySite.Web.Pipelines.RegisterPlatformBundles, MySite (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)). Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Could not resolve type name: MySite.Web.Pipelines.RegisterPlatformBundles, MySite (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[Exception: Could not resolve type name: MySite.Web.Pipelines.RegisterPlatformBundles, MySite (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).]
Sitecore.Diagnostics.Error.Raise(String error, String method) +137
Sitecore.Configuration.DefaultFactory.CreateType(XmlNode configNode, String[] parameters, Boolean assert) +308
Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert) +71
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper) +165
Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert) +68
Sitecore.Pipelines.CorePipelineFactory.GetObjectFromType(XmlNode processorNode) +91
Sitecore.Pipelines.CorePipelineFactory.GetProcessorObject(XmlNode processorNode) +145
Sitecore.Pipelines.CoreProcessor.GetMethod(Object[] parameters) +144
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +470
Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
Sitecore.Nexus.Web.HttpModule.Application_Start() +262
Sitecore.Nexus.Web.HttpModule.Init(HttpApplication app) +704
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +618
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Could not resolve type name: MySite.Web.Pipelines.RegisterPlatformBundles, MySite (method: Sitecore.Configuration.DefaultFactory.CreateFromTypeName(XmlNode configNode, String[] parameters, Boolean assert)).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +125 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +731

+0

Bitte lesen Sie diese [LINK] (https://sitecore.stackexchange.com/questions/3434/is-there-something-in-sitecore-8-2-that-breaks -bundling) – Thennarasan

Antwort

0

Ich habe den bereitgestellten Code und den Hauptgrund getestet, warum Sie diesen Fehler erhalten, weil die Anordnung Mysite nicht in dem Ordner ist ist.

  1. Stellen Sie sicher, dass die MySite.dll in den Ordner bin kopiert wird. MySite.Web.Pipelines.RegisterPlatformBundles, MySite
  2. Namespace gilt
+0

Danke, das habe ich mir gedacht. Ich wollte nur sicherstellen, dass ich nichts vermisse. Diese Art bestätigte es. Ich habe herausgefunden, was es verursacht hat. Mein Projekt hatte einen Platz im Namen, sodass die Assembly an einigen Stellen einen Platz und in anderen einen Unterstrich hatte. Ich habe alle Referenzen auf den Platz entfernt und unterstrichen. Dann konnte es meine Versammlung finden. –

Verwandte Themen