2017-05-13 13 views
0

Sitecore 8.2 MVC를 설정하고 MVC 번들을 사용하여 모든 스크립트와 스타일을 기본 레이아웃으로 가져 오려고했습니다. 글로벌 파일이 더 이상 사용되지 않고 파이프 라인을 사용하여 불도저를 초기화해야하는 모범 사례 때문에 문제가 발생했습니다.Sitecore 8.2 MVC에서 MVC 번들을 사용할 수 없습니다.

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")); 

     } 

    } 

나는 설정 파일을 다음 따르며, 파이프 라인에 추가했습니다.

<?xml version="1.0"?> 
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> 
    <sitecore> 
    <pipelines> 
     <initialize> 
     <processor patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeGlobalFilters, Sitecore.Mvc']" 
      type="MySite.Web.Pipelines.RegisterPlatformBundles, MySite" /> 
     </initialize> 
    </pipelines> 
    </sitecore> 
</configuration> 

사이트를 실행하려고하면 다음과 같은 오류가 발생합니다. 이것을 설정하는 데 도움이되는 조언이나 올바른 경로만으로도 좋습니다. 감사.

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

이 [LINK (https://sitecore.stackexchange.com/questions/3434/is-there-something-in-sitecore-8-2-that-breaks을 참조하시기 바랍니다 -bundling) – Thennarasan

답변

0

나는 제공된 코드 및 어셈블리 Mysite이 bin 폴더에 존재하지 않기 때문에이다이 오류가 발생하는 주된 이유를 테스트했습니다.

  1. MySite.dll이 bin 폴더로 복사되었는지 확인하십시오.
  2. 네임 MySite.Web.Pipelines.RegisterPlatformBundles, MySite 유효
+0

고마워, 그게 내가 생각한거야. 나는 단지 내가 무엇이든 놓치지 않았는지 확인하고 싶었다. 이런 종류의 확인. 나는 실제로 그 원인을 밝혀 냈습니다. 내 프로젝트에는 이름에 공백이 있었기 때문에 어셈블리가 일부 장소에는 공간을, 다른 지역에는 밑줄이 생겨났습니다. 나는 공간과 밑줄에 대한 모든 언급을 삭제했다. 그런 다음 내 어셈블리를 찾을 수있었습니다. –