title: WCF Service is showing error after implemented in IIS
body: <p>In my project I am using Enterprise Library to connect to database. It is working fine when I run the application from Visual Studio directly.</p>
  
  <p>But this is showing error connecting to database when hosted in IIS on same machine. I have added log trace and got the following error</p>
  
  <blockquote>
    <p>Resolution of the dependency failed, type =
    "Microsoft.Practices.EnterpriseLibrary.Data.Database", name =
    "(none)". Exception occurred while: while resolving. Exception is:
    InvalidOperationException - The type Database cannot be constructed.
    You must configure the container to supply this value.
    ----------------------------------------------- At the time of the
    exception, the container was:</p>
    
    <p>Resolving Microsoft.Practices.EnterpriseLibrary.Data.Database,(none)
    | Exception:Microsoft.Practices.ServiceLocation.ActivationException:
    Activation error occured while trying to get instance of type
    Database, key "" --->
    Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the
    dependency failed, type =
    "Microsoft.Practices.EnterpriseLibrary.Data.Database", name =
    "(none)". Exception occurred while: while resolving. Exception is:
    InvalidOperationException - The type Database cannot be constructed.
    You must configure the container to supply this value.
    ----------------------------------------------- At the time of the
    exception, the container was:</p>
    
    <p>Resolving Microsoft.Practices.EnterpriseLibrary.Data.Database,(none)
    ---> System.InvalidOperationException: The type Database cannot be
    constructed. You must configure the container to supply this value.<br>
    at
    Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext
    context, SelectedConstructor selectedConstructor)    at
    Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext
    context)    at
    Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext
    context)    at
    Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext
    context, NamedTypeBuildKey buildKey)    at
    Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext
    context)    at
    Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext
    context)    at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type
    t, Object existing, String name, IEnumerable<code>1 resolverOverrides)<br>
    --- End of inner exception stack trace ---    at
    Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object
    existing, String name, IEnumerable</code>1 resolverOverrides)    at
    Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String
    name, IEnumerable`1 resolverOverrides)    at
    Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type
    serviceType, String key)    --- End of inner exception stack trace ---
    at
    Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type
    serviceType, String key)    at
    Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService](String
    key)    at
    Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.InnerCreateDatabase(String
    name)</p>
  </blockquote>
  
  <p>My <code>web.config</code> of service is contains as below</p>
  
  <pre><code>&lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/&gt;
      &lt;section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/&gt;
    &lt;/configSections&gt;
  &lt;dataConfiguration defaultDatabase="OracleConnection"&gt;
      &lt;providerMappings&gt;
        &lt;add databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase, Microsoft.Practices.EnterpriseLibrary.Data" name="Oracle.DataAccess.Client"/&gt;
      &lt;/providerMappings&gt;
    &lt;/dataConfiguration&gt;
    &lt;connectionStrings&gt;
        &lt;add name="OracleConnection" providerName="Oracle.DataAccess.Client" connectionString="User Id=***;Password=****;Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=*****)(PORT=1500)) (CONNECT_DATA=(SERVER = DEDICATED) (SERVICE_NAME =*****)));"/&gt;
  &lt;add name="SybaseConnection" connectionString="providerName=Sybase.ASEOLEDBProvider;Server=****;Port=5050;Catalog=**;User Id=***;Password=****"/&gt;
        &lt;/connectionStrings&gt;
  </code></pre>
  
  <p>I tried a lot but unable to find the cause of issue. :(</p>
  
  <p>I checked the permission on the folder and Everyone has full control. WCF Service in IIS Anonymous access is enabled.</p>
  
  <p>Could anyone please help?</p>