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.
var container = builder.Build(); var resolver = new AutofacWebApiDependencyResolver(container); GlobalConfiguration.Configuration.DependencyResolver = resolver; DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
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:
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
Hi All
Solved this issue by updating all the nuget packages :)
Cheers!
is working on a reply...