Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • yogesh pathak 136 posts 221 karma points
    Jun 03, 2015 @ 14:01
    yogesh pathak
    0

    Error while trying to debug ASP.NET Umbraco application

    Hi All,

    i am having a strange issue here when i try to debug my ASP.NET MVC Umbraco application it says

    Server Error in '/' Application.

    Attempt by method 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' to access method 'System.Web.Http.HttpConfiguration.DefaultFormatters()' failed.

    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.MethodAccessException: Attempt by method 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' to access method 'System.Web.Http.HttpConfiguration.DefaultFormatters()' failed.

    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:

    [MethodAccessException: Attempt by method 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' to access method 'System.Web.Http.HttpConfiguration.DefaultFormatters()' failed.]
       System.Web.Http.HttpConfiguration..ctor(HttpRouteCollection routes) +93
       System.Web.Http.GlobalConfiguration.<.cctor>b__0() +95
       System.Lazy`1.CreateValue() +416
       System.Lazy`1.LazyInitValue() +152
       System.Lazy`1.get_Value() +75
       System.Web.Http.GlobalConfiguration.get_Configuration() +35
       Umbraco.Web.WebBootManager.InitializeResolvers() +727
       Umbraco.Core.CoreBootManager.Initialize() +449
       Umbraco.Web.WebBootManager.Initialize() +128
       Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +152
       Umbraco.Core.UmbracoApplicationBase.Application_Start(Object sender, EventArgs e) +40
    
    [HttpException (0x80004005): Attempt by method 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' to access method 'System.Web.Http.HttpConfiguration.DefaultFormatters()' failed.]
       System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9917985
       System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
       System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
       System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
       System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
    
    [HttpException (0x80004005): Attempt by method 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' to access method 'System.Web.Http.HttpConfiguration.DefaultFormatters()' failed.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9931880
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
    

     

    i am using Autofac for IOC/DI here is the Initilizer

      builder.Register(c => UmbracoContext.Current).AsSelf();
                builder.RegisterControllers(Assembly.GetExecutingAssembly());
                builder.RegisterApiControllers(typeof(UmbracoApplication).Assembly);

                // Register application specific types

                //


                var container = builder.Build();
                var resolver = new AutofacWebApiDependencyResolver(container);
                GlobalConfiguration.Configuration.DependencyResolver = resolver;
                DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

     

    Any help will be appriciated

    Thanks

    Yogesh

  • yogesh pathak 136 posts 221 karma points
    Jun 04, 2015 @ 08:58
    yogesh pathak
    100

    Hi All

    Solved this issue by updating all the nuget packages :)

    Cheers!

Please Sign in or register to post replies

Write your reply to:

Draft