Does any one know why autofac fails to initialize the mvc controllers when there is an applicaton in the root and also another in sub application in IIS? How to fix this?
When the apps are hosted in different Websites in IIS they work without a problem.
so in the image, the root app(mvc web) deployed in the root works but not the webservice (mvc api).
error is
An error has occurred.An error occurred when trying to create a controller of type 'UserController'. Make sure that the controller has a parameterless public constructor.System.InvalidOperationException at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)
at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()An error has occurred.An exception was thrown while invoking the constructor 'Void .ctor()' on type 'BurpDaddyEntities'. ---> The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception. (See inner exception for details.)Autofac.Core.DependencyResolutionException at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable
1 parameters)