+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Build error trying to implement custom error pages for MVC and Feather

Build error trying to implement custom error pages for MVC and Feather

4 posts, 1 answered
  1. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    29 Mar
    Link to this post

    When following along the below knowlege base article I receive a build error for the SitefinityWebApp.dll. 

    http://www.sitefinity.com/developer-network/knowledge-base/details/custom-error-pages-with-sitefinity-mvc-and-feather

     

    Here is the error:

    System.SystemException: Unable to load assembly 'SitefinityWebApp, Version=8.2.5900.0, Culture=neutral, PublicKeyToken=null' : Could not load file or assembly 'Telerik.Sitefinity, Version=8.2.5900.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' or one of its dependencies. General Exception (Exception from HRESULT: 0x80131500) ---> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
       at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
       at System.Reflection.RuntimeModule.GetTypes()
       at System.Reflection.Assembly.GetTypes()
       at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
       --- End of inner exception stack trace ---
       at Telerik.OpenAccess.Metadata.MetadataAttributesReader.PrepareMetaModelTypes(Assembly assembly)
       at Telerik.OpenAccess.Metadata.MetadataAttributesReader.ReadMetaModel(Assembly assembly)
       at Telerik.OpenAccess.Metadata.AttributesMetadataSource.<>c__DisplayClass1.<FromAssembly>b__0()
       at Telerik.OpenAccess.Metadata.AttributesMetadataSource.CreateModel()
       at Telerik.OpenAccess.Metadata.MetadataSource.GetModelCore(MetadataContainer old)
       at Telerik.OpenAccess.Sdk.Enhancer.Enhancer.CrossDomainRunImpl(AssemblyLoader assemblyLoader)
       at Telerik.OpenAccess.Sdk.Enhancer.EnhancerBase.CrossDomainRun()

    I have looked at all my references and just am not seeing what is getting in the way.

    Here is my code:

    using System.Web;
    using Telerik.Microsoft.Practices.Unity;
    using Telerik.Sitefinity.Abstractions;
    using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Routing;
    using Telerik.Sitefinity.Mvc;
    using Telerik.Sitefinity.Services;
     
    namespace SitefinityWebApp
    {
        public class FeatherActionInvokerCustom : FeatherActionInvoker
        {
            protected override void RestoreHttpContext(string output, HttpContext initialContext)
            {
                this.PopulateResponseStatus(System.Web.HttpContext.Current, initialContext);
     
                base.RestoreHttpContext(output, initialContext);
            }
     
            private void PopulateResponseStatus(HttpContext httpContext, HttpContext initialContext)
            {
     
                if (!SystemManager.IsDesignMode && httpContext.Response.StatusCode != 200)
                {
                    initialContext.Response.Status = httpContext.Response.Status;
                    initialContext.Response.StatusCode = httpContext.Response.StatusCode;
                    initialContext.Response.StatusDescription = httpContext.Response.StatusDescription;
                }
            }
     
            internal static void Register()
            {
                ObjectFactory.Container.RegisterType<IControllerActionInvoker, FeatherActionInvokerCustom>();
            }
        }
    }

  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    24 Nov 2016
    06 Apr
    Link to this post
    Hi Stacey,

    Are you using the NuGet packages and the OA enhancer?
    Are you using the enhancer yourself and do you have custom modules built with Thunder?

    The issue is most probably caused by the OpenAccess enhancer.

    Please, unload the project and edit the .csproj. Comment or remove the enhancer import:
    Copy Code
    Copy Code
    <Import Project="OpenAccessNuget.targets" /> to  <!--<Import Project="OpenAccessNuget.targets" />-->
    If you are not using the enhancer, the project should be working correctly.

    Reload and build the project. The build should be successful now.


    If the error persists but now runtime, it points to an assembly version mismatch. A binding redirect should be used. Please, follow this article:
    http://www.sitefinity.com/developer-network/knowledge-base/details/could-not-load-file-or-assembly-error-when-upgrading-to-sitefinity

    Hope this helps.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
    Answered
  3. Stacey
    Stacey avatar
    291 posts
    Registered:
    18 Oct 2012
    06 Apr in reply to Nikola Zagorchev
    Link to this post

    Yes, I am using NuGet packages.  I am not actively or knowingly using OA enhancer and I have not used Thunder on this project.

    Removing the import reference from my project file allowed me to build and so far testing looks good in that I am seeing a proper 404 status returned when I expect it.

    Are there any repercussions you can think of with me disabling OA enhancer?  

     

  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    24 Nov 2016
    06 Apr
    Link to this post
    Hi Stacey,

    If you are not using the enhancer to enhance custom modules (built with Thunder and not recommended) you should not have any problems.

    Regards,
    Nikola Zagorchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 1 answered