Build error trying to implement custom error pages for MVC a

Posted by Community Admin on 04-Aug-2018 18:15

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

All Replies

Posted by Community Admin on 29-Mar-2016 00:00

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

Posted by Community Admin on 06-Apr-2016 00:00

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
 

Posted by Community Admin on 06-Apr-2016 00:00

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?  

 

Posted by Community Admin on 06-Apr-2016 00:00

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
 

This thread is closed