{"action":"closed","issue":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1258","labels_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1258/labels{/name}","comments_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1258/comments","events_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/1258/events","html_url":"https://github.com/IdentityServer/IdentityServer3/issues/1258","id":70823712,"number":1258,"title":"Hosted Web Api 2 Dependancy injection registerd using AutoFac Error From IIS","user":{"login":"tarekselem","id":11707911,"avatar_url":"https://avatars.githubusercontent.com/u/11707911?v=3","gravatar_id":"","url":"https://api.github.com/users/tarekselem","html_url":"https://github.com/tarekselem","followers_url":"https://api.github.com/users/tarekselem/followers","following_url":"https://api.github.com/users/tarekselem/following{/other_user}","gists_url":"https://api.github.com/users/tarekselem/gists{/gist_id}","starred_url":"https://api.github.com/users/tarekselem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tarekselem/subscriptions","organizations_url":"https://api.github.com/users/tarekselem/orgs","repos_url":"https://api.github.com/users/tarekselem/repos","events_url":"https://api.github.com/users/tarekselem/events{/privacy}","received_events_url":"https://api.github.com/users/tarekselem/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-24T23:40:23Z","updated_at":"2015-04-25T09:14:06Z","closed_at":"2015-04-25T09:14:06Z","body":"The following error appearing after calling any action from a controller :\r\nNote : Error doesn't appear in development environment .\r\n \r\n{\"Message\":\"An error has occurred.\",\"ExceptionMessage\":\"An error occurred when trying to create a controller of type 'RegionController'. Make sure that the controller has a parameterless public constructor.\",\"ExceptionType\":\"System.InvalidOperationException\",\"StackTrace\":\"   at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)\\r\\n   at System.Web.Http.Controllers.HttpControllerDescriptor.CreateController(HttpRequestMessage request)\\r\\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()\",\"InnerException\":{\"Message\":\"An error has occurred.\",\"ExceptionMessage\":\"An exception was thrown while invoking the constructor 'Void .ctor()' on type 'UnitOfWork'. ---> The type initializer for 'Application.DAL.UnitOfWork' threw an exception. (See inner exception for details.)\",\"ExceptionType\":\"Autofac.Core.DependencyResolutionException\",\"StackTrace\":\"   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()\\r\\n   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)\\r\\n   at Autofac.Core.Resolving.InstanceLookup.Execute()\\r\\n   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()\\r\\n   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Resolving.InstanceLookup.Execute()\\r\\n   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()\\r\\n   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Resolving.InstanceLookup.Execute()\\r\\n   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()\\r\\n   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Resolving.InstanceLookup.Execute()\\r\\n   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)\\r\\n   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)\\r\\n   at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)\\r\\n   at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.GetInstanceOrActivator(HttpRequestMessage request, Type controllerType, Func`1& activator)\\r\\n   at System.Web.Http.Dispatcher.DefaultHttpControllerActivator.Create(HttpRequestMessage request, HttpControllerDescriptor controllerDescriptor, Type controllerType)\",\"InnerException\":{\"Message\":\"An error has occurred.\",\"ExceptionMessage\":\"The type initializer for 'Application.DAL.UnitOfWork' threw an exception.\",\"ExceptionType\":\"System.TypeInitializationException\",\"StackTrace\":\"   at Application.DAL.UnitOfWork..ctor()\\r\\n   at lambda_method(Closure , Object[] )\\r\\n   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()\",\"InnerException\":{\"Message\":\"An error has occurred.\",\"ExceptionMessage\":\"The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.\",\"ExceptionType\":\"System.TypeInitializationException\",\"StackTrace\":\"   at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.EnsureLoadedForAssembly(Assembly assemblyHint, Type contextTypeHint)\\r\\n   at System.Data.Entity.Database.SetInitializer[TContext](IDatabaseInitializer`1 strategy)\",\"InnerException\":{\"Message\":\"An error has occurred.\",\"ExceptionMessage\":\"An error occurred creating the configuration section handler for entityFramework: The provider for invariant name 'System.Data.SqlClient' is specified multiple times in the application configuration. The invariant name must be unique for each configured provider. (C:\\\\Remove\\\\AutoWorld__Demo\\\\Application.WebApi\\\\web.config line 99)\",\"ExceptionType\":\"System.Configuration.ConfigurationErrorsException\",\"StackTrace\":\"   at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)\\r\\n   at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)\\r\\n   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)\\r\\n   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)\\r\\n   at System.Data.Entity.Internal.AppConfig..ctor()\\r\\n   at System.Data.Entity.Internal.AppConfig..cctor()\",\"InnerException\":{\"Message\":\"An error has occurred.\",\"ExceptionMessage\":\"The provider for invariant name 'System.Data.SqlClient' is specified multiple times in the application configuration. The invariant name must be unique for each configured provider.\",\"ExceptionType\":\"System.InvalidOperationException\",\"StackTrace\":\"   at System.Data.Entity.Internal.ConfigFile.ProviderCollection.BaseAdd(ConfigurationElement element)\\r\\n   at System.Configuration.ConfigurationElementCollection.OnDeserializeUnrecognizedElement(String elementName, XmlReader reader)\\r\\n   at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)\\r\\n   at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)\\r\\n   at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)\\r\\n   at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)\\r\\n   at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)\\r\\n   at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)\"}}}}}}"}}