Enterprise Library issue with error logging..for my asp.net mvc application

Topics: Exception Handling Application Block, Logging Application Block
Oct 19, 2010 at 12:01 AM

Hello Friends, I am getting this Error.. This is my Web.config file..

<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
   
<listeners>
     
<add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" source="Enterprise Library Logging" formatter="Text Formatter" log="Application" machineName="." traceOutputOptions="None" />
     
<add name="Database Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" databaseInstanceName="MiscEntities" writeLogStoredProcName="WriteLog" addCategoryStoredProcName="AddCategory" />
     
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="BenefitBuilder.log" formatter="Text Formatter" rollFileExistsBehavior="Increment" rollInterval="Day" />
   
</listeners>
   
<formatters>
     
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}" name="Text Formatter" />
   
</formatters>
   
<categorySources>
     
<add switchValue="All" name="General">
       
<listeners>
         
<add name="Rolling Flat File Trace Listener" />
         
<add name="Database Trace Listener" />
         
<add name="Event Log Listener" />
       
</listeners>
     
</add>
     
<add switchValue="All" name="Database">
       
<listeners>
         
<add name="Database Trace Listener" />
       
</listeners>
     
</add>
     
<add switchValue="All" name="RollingFlatFile">
       
<listeners>
         
<add name="Rolling Flat File Trace Listener" />
       
</listeners>
     
</add>
     
<add switchValue="All" name="EventLog">
       
<listeners>
         
<add name="Event Log Listener" />
       
</listeners>
     
</add>
   
</categorySources>
   
<specialSources>
     
<allEvents switchValue="All" name="All Events">
       
<listeners>
         
<add name="Rolling Flat File Trace Listener" />
       
</listeners>
     
</allEvents>
     
<notProcessed switchValue="All" name="Unprocessed Category">
       
<listeners>
         
<add name="Rolling Flat File Trace Listener" />
       
</listeners>
     
</notProcessed>
     
<errors switchValue="All" name="Logging Errors &amp; Warnings">
       
<listeners>
         
<add name="Event Log Listener" />
       
</listeners>
     
</errors>
   
</specialSources>
 
</loggingConfiguration>
 
<exceptionHandling>
   
<exceptionPolicies>
     
<add name="Benefit Builder Policy">
       
<exceptionTypes>
         
<add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="None">
           
<exceptionHandlers>
             
<add name="Logging Exception Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" priority="0" />
           
</exceptionHandlers>
         
</add>
       
</exceptionTypes>
     
</add>
   
</exceptionPolicies>
 
</exceptionHandling>

Activation error occured while trying to get instance of type LogWriter, key When I using my Logging error ..

this is the code to log my error in my ControllerBase.cs

private static void LogException( Exception ex, ExceptionContext filterContext ) {
           
if (Logger.IsLoggingEnabled())
           
{
               
var logEntry = MvcUnity.Container.Resolve<LogEntry>();
                logEntry
.Title = filterContext.Exception.Message;
                logEntry
.Message = filterContext.Exception.ToString();
                logEntry
.AddErrorMessage("Source: " + ex.Source + "/r/nTarget: " + ex.TargetSite + "/r/nMessage: " +
                                         ex
.Message + "/r/nHelp Link: " + ex.HelpLink + "/r/n");
                logEntry
.AddErrorMessage("Stack Trace: /r/n" + ex.StackTrace + "/r/n");
                logEntry
.AddErrorMessage("Data: /r/n" + ex.Data + "/r/n");
                logEntry
.AddErrorMessage("Inner Exception: " + ex.InnerException + "/r/n");
               
Logger.Write(logEntry);
           
}
       
}

I am getting Invalidaoperationexception

InvalidOperationException: The Type Database cannot be constructed,you mush configure the Container to supply this value

This Error I am getting while I am checking Logger.IsLogEnabled() and Logger.Write(logEntry)

Can any body help me out why its giving that error message?

thanks

Oct 19, 2010 at 12:06 AM

Are you referencing the Data assembly from GAC?  If yes, you're probably experiencing this issue.   The workaround is also mentioned there.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 19, 2010 at 12:09 AM

Thanks Avanade, 

No I am not referecing from data assembly GAC... the above is my webconfig file which I am doing.. and I am getting this Error..

 

Thanks

 

Oct 19, 2010 at 12:11 AM

Have you checked the Copy Local property of your Microsoft.Practices.EnterpriseLibrary.Data reference?  If it's set to True, it's trying to load that assembly from GAC. 

One more thing, could you post your relevant connectionstring entry as well?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 19, 2010 at 12:14 AM

Thanks  for your support Avanade, here is my web config file..

<connectionStrings>    <add name="GeneralConnectionString" connectionString="Data Source=208.103.111.27,9500;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True" />    <add name="CodeEntities" connectionString="metadata=res://*/Models.AppCodes.CodesModel.csdl|res://*/Models.AppCodes.CodesModel.ssdl|res://*/Models.AppCodes.CodesModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="BvEntities" connectionString="metadata=res://*/Models.BenVariables.BvModel.csdl|res://*/Models.BenVariables.BvModel.ssdl|res://*/Models.BenVariables.BvModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="ObnEntities" connectionString="metadata=res://*/Models.Obn.ObnModel.csdl|res://*/Models.Obn.ObnModel.ssdl|res://*/Models.Obn.ObnModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="BbpEntities" connectionString="metadata=res://*/Models.BbProcessor.BbpModel.csdl|res://*/Models.BbProcessor.BbpModel.ssdl|res://*/Models.BbProcessor.BbpModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="ProductEntities" connectionString="metadata=res://*/Models.Product.ProductModel.csdl|res://*/Models.Product.ProductModel.ssdl|res://*/Models.Product.ProductModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="SecEntities" connectionString="metadata=res://*/Models.Security.SecModel.csdl|res://*/Models.Security.SecModel.ssdl|res://*/Models.Security.SecModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="AcctEntities" connectionString="metadata=res://*/Models.AcctMembership.AcctModel.csdl|res://*/Models.AcctMembership.AcctModel.ssdl|res://*/Models.AcctMembership.AcctModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="MiscEntities" connectionString="metadata=res://*/Models.MiscTables.MiscModel.csdl|res://*/Models.MiscTables.MiscModel.ssdl|res://*/Models.MiscTables.MiscModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="GenericBenefitLibraryEntities" connectionString="metadata=res://*/Models.Generic.Generic.csdl|res://*/Models.Generic.Generic.ssdl|res://*/Models.Generic.Generic.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />    <add name="StoredProcedureEntities" connectionString="metadata=res://*/Models.StoredProcedures.csdl|res://*/Models.StoredProcedures.ssdl|res://*/Models.StoredProcedures.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=ehodys;Password=Cuteboy448;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />  </connectionStrings>

Oct 19, 2010 at 12:18 AM

Here is my full web config file..

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->

<configuration>
 
<configSections>
   
<!--<section name="spark" type="Spark.Configuration.SparkSectionHandler, Spark" />-->
   
<section name="securityConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Configuration.SecuritySettings, Microsoft.Practices.EnterpriseLibrary.Security, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
   
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
   
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
   
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
   
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
   
<section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
   
<sectionGroup name="telerik">
     
<section name="webAssets" type="Telerik.Web.Mvc.Configuration.WebAssetConfigurationSection, Telerik.Web.Mvc" requirePermission="false" />
   
</sectionGroup>
 
</configSections>
 
<securityConfiguration>
   
<authorizationProviders>
     
<add type="Microsoft.Practices.EnterpriseLibrary.Security.AuthorizationRuleProvider, Microsoft.Practices.EnterpriseLibrary.Security, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Authorization Rule Provider" />
   
</authorizationProviders>
   
<securityCacheProviders>
     
<add type="Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore.CachingStoreProvider, Microsoft.Practices.EnterpriseLibrary.Security.Cache.CachingStore, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" cacheManagerInstanceName="Benefit Builder Cache Manager" defaultSlidingSessionExpirationInMinutes="10" defaultAbsoluteSessionExpirationInMinutes="60" name="Benefit Builder Security Cache" />
   
</securityCacheProviders>
 
</securityConfiguration>
 
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
   
<listeners>
     
<add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" source="Enterprise Library Logging" formatter="Text Formatter" log="Application" machineName="." traceOutputOptions="None" />
     
<add name="Database Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" databaseInstanceName="MiscEntities" writeLogStoredProcName="WriteLog" addCategoryStoredProcName="AddCategory" />
     
<add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="BenefitBuilder.log" formatter="Text Formatter" rollFileExistsBehavior="Increment" rollInterval="Day" />
   
</listeners>
   
<formatters>
     
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}" name="Text Formatter" />
   
</formatters>
   
<categorySources>
     
<add switchValue="All" name="General">
       
<listeners>
         
<add name="Rolling Flat File Trace Listener" />
         
<add name="Database Trace Listener" />
         
<add name="Event Log Listener" />
       
</listeners>
     
</add>
     
<add switchValue="All" name="Database">
       
<listeners>
         
<add name="Database Trace Listener" />
       
</listeners>
     
</add>
     
<add switchValue="All" name="RollingFlatFile">
       
<listeners>
         
<add name="Rolling Flat File Trace Listener" />
       
</listeners>
     
</add>
     
<add switchValue="All" name="EventLog">
       
<listeners>
         
<add name="Event Log Listener" />
       
</listeners>
     
</add>
   
</categorySources>
   
<specialSources>
     
<allEvents switchValue="All" name="All Events">
       
<listeners>
         
<add name="Rolling Flat File Trace Listener" />
       
</listeners>
     
</allEvents>
     
<notProcessed switchValue="All" name="Unprocessed Category">
       
<listeners>
         
<add name="Rolling Flat File Trace Listener" />
       
</listeners>
     
</notProcessed>
     
<errors switchValue="All" name="Logging Errors &amp; Warnings">
       
<listeners>
         
<add name="Event Log Listener" />
       
</listeners>
     
</errors>
   
</specialSources>
 
</loggingConfiguration>
 
<exceptionHandling>
   
<exceptionPolicies>
     
<add name="Benefit Builder Policy">
       
<exceptionTypes>
         
<add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="None">
           
<exceptionHandlers>
             
<add name="Logging Exception Handler" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" priority="0" />
           
</exceptionHandlers>
         
</add>
       
</exceptionTypes>
     
</add>
   
</exceptionPolicies>
 
</exceptionHandling>
 
<dataConfiguration defaultDatabase="MiscEntities" />
 
<connectionStrings>
   
<add name="GeneralConnectionString" connectionString="Data Source=208.103.111.27,9500;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True" />
   
<add name="CodeEntities" connectionString="metadata=res://*/Models.AppCodes.CodesModel.csdl|res://*/Models.AppCodes.CodesModel.ssdl|res://*/Models.AppCodes.CodesModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="BvEntities" connectionString="metadata=res://*/Models.BenVariables.BvModel.csdl|res://*/Models.BenVariables.BvModel.ssdl|res://*/Models.BenVariables.BvModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="ObnEntities" connectionString="metadata=res://*/Models.Obn.ObnModel.csdl|res://*/Models.Obn.ObnModel.ssdl|res://*/Models.Obn.ObnModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="BbpEntities" connectionString="metadata=res://*/Models.BbProcessor.BbpModel.csdl|res://*/Models.BbProcessor.BbpModel.ssdl|res://*/Models.BbProcessor.BbpModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="ProductEntities" connectionString="metadata=res://*/Models.Product.ProductModel.csdl|res://*/Models.Product.ProductModel.ssdl|res://*/Models.Product.ProductModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="SecEntities" connectionString="metadata=res://*/Models.Security.SecModel.csdl|res://*/Models.Security.SecModel.ssdl|res://*/Models.Security.SecModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="AcctEntities" connectionString="metadata=res://*/Models.AcctMembership.AcctModel.csdl|res://*/Models.AcctMembership.AcctModel.ssdl|res://*/Models.AcctMembership.AcctModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="MiscEntities" connectionString="metadata=res://*/Models.MiscTables.MiscModel.csdl|res://*/Models.MiscTables.MiscModel.ssdl|res://*/Models.MiscTables.MiscModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500\MSSQLSERVER;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;Pooling=False;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="GenericBenefitLibraryEntities" connectionString="metadata=res://*/Models.Generic.Generic.csdl|res://*/Models.Generic.Generic.ssdl|res://*/Models.Generic.Generic.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=BenefitBuilderAppLogin;Password=A1batr0$;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
   
<add name="StoredProcedureEntities" connectionString="metadata=res://*/Models.StoredProcedures.csdl|res://*/Models.StoredProcedures.ssdl|res://*/Models.StoredProcedures.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=208.103.111.27,9500;Initial Catalog=BenefitLibrary;Persist Security Info=True;User ID=ehodys;Password=Cuteboy448;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
 
</connectionStrings>
 
<enterpriseLibrary.ConfigurationSource selectedSource="System Configuration Source">
   
<sources>
     
<add name="System Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.SystemConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
   
</sources>
 
</enterpriseLibrary.ConfigurationSource>
 
<cachingConfiguration defaultCacheManager="Benefit Builder Cache Manager">
   
<cacheManagers>
     
<add name="Benefit Builder Cache Manager" type="Microsoft.Practices.EnterpriseLibrary.Caching.CacheManager, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" expirationPollFrequencyInSeconds="60" maximumElementsInCacheBeforeScavenging="1000" numberToRemoveWhenScavenging="10" backingStoreName="NullBackingStore" />
   
</cacheManagers>
   
<backingStores>
     
<add type="Microsoft.Practices.EnterpriseLibrary.Caching.BackingStoreImplementations.NullBackingStore, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="NullBackingStore" />
   
</backingStores>
 
</cachingConfiguration>
 
<system.web>
   
<!--<trace enabled="true" pageOutput="true" requestLimit="40" localOnly="false"/>-->
   
<compilation debug="true" targetFramework="4.0">
     
<assemblies>
       
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
       
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     
</assemblies>
     
<buildProviders>
       
<!-- add extension=".spark" type="System.Web.Compilation.PageBuildProvider"/ -->
     
</buildProviders>
   
</compilation>
   
<authentication mode="Forms">
     
<forms loginUrl="~/Account/LogOn" timeout="2880" />
   
</authentication>
   
<pages>
     
<namespaces>
       
<add namespace="System.Web.Mvc" />
       
<add namespace="System.Web.Mvc.Ajax" />
       
<add namespace="System.Web.Mvc.Html" />
       
<add namespace="System.Web.Routing" />
       
<add namespace="System.Linq" />
       
<add namespace="System.Collections.Generic" />
       
<add namespace="Telerik.Web.Mvc.UI" />
       
<add namespace="NascoBenefitBuilder.Helpers" />
     
</namespaces>
   
</pages>
   
<customErrors mode="On" defaultRedirect="~/Home/Error">
     
<error statusCode="403" redirect="~/Home/Error" />
     
<error statusCode="404" redirect="~/Home/Error" />
   
</customErrors>
   
<httpHandlers>
     
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     
<add verb="GET,HEAD" path="asset.axd" validate="false" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
   
</httpHandlers>
   
<httpModules>
     
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
     
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
   
</httpModules>
 
</system.web>
 
<system.webServer>
   
<validation validateIntegratedModeConfiguration="false" />
   
<modules runAllManagedModulesForAllRequests="true" />
   
<handlers>
     
<remove name="asset" />
     
<add name="asset" preCondition="integratedMode" verb="GET,HEAD" path="asset.axd" type="Telerik.Web.Mvc.WebAssetHttpHandler, Telerik.Web.Mvc" />
   
</handlers>
 
</system.webServer>
 
<runtime>
   
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
     
<dependentAssembly>
       
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
       
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
     
</dependentAssembly>
   
</assemblyBinding>
 
</runtime>
 
<telerik>
   
<webAssets useTelerikContentDeliveryNetwork="false" />
 
</telerik>
 
<!--<spark>
        compilation debug=”true”
    </spark>-->

</configuration>

 

Oct 19, 2010 at 12:30 AM

Do you have an entry for the System.Data.EntityClient in the <DbProviderFactories> element?  You can add it on your web.config or on the machine.config.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 19, 2010 at 12:36 AM

Avanade  thanks, 

the way I have webconfig file that's it.. I dont know where to add this System.data.EntityClient in the DbProviderFactories? please can you look in to my web config file to check I am doing right? this is urgent work for me help me out thanks

 

Thanks

Oct 19, 2010 at 12:41 AM

It should be under the system.data element.  A sample is given in the link I posted. Although I don't know yet the exact values to put for each of the attributes for the EntityClient.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 19, 2010 at 12:44 AM

I dont have <system.data> tag in the web config file Avanada. thanks

Oct 19, 2010 at 12:45 AM

You need to add it then.

Oct 19, 2010 at 12:52 AM

Because of that I am getting that issue Avananda?

Thanks

Oct 19, 2010 at 1:12 AM

Yes.  Here's the sample entry for that.

<system.data>
      <DbProviderFactories>
	<add name="EF Data Provider" invariant="System.Data.EntityClient" type="System.Data.EntityClient.EntityProviderFactory, System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" description="Entity Framework Provider"></add>
       <DbProviderFactories>
</system.data>

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 19, 2010 at 1:19 AM

After adding this code I am still getting the same Error.. 

 

thanks

Oct 19, 2010 at 1:51 AM

I tried to repro by adding a database trace listener which uses a database instance referencing a connection string having its providerName attribute set to  System.Data.EntityClient.  I'm not getting the error you're encountering even if I don't have that lines in my config file when calling Logger.IsLoggingEnabled.  It is only when I attempt to create a Database object. 

Adding that line of code allows me to successfully create then a Database object.

Do you have a reference to the Logging.Database asembly?

Have you also verified that the Copy Local property of this assembly reference as well as that of the Data assembly reference is set to True?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 19, 2010 at 1:57 AM

Thanks Avananda for your suport,

 

Please can you look in to my issue with teamviewer? I can porvide you Id and pass? so that you can remotly connect to my PC?

please can you help me out.. 

 

Thanks

Oct 19, 2010 at 2:36 AM

Currently, we are not yet setup to provide support via team viewer. We provide support via codeplex that we regularly monitor by posting responses to community users questions.

Here's what we can do.  Create a simple web project.  In its web.config, add to it the same "MiscEntities" connectionstring.  Add then the Logging Settings and add a Database Trace Listener using "MiscEntities" as the database instance.  Reference the same assemblies you referenced in your original web app project.  See if you will be able to repro the error you're getting.  If yes, add the <system.Data> configuration section I posted previously.  Check again if you will still encounter the error.  If yes, send it then to me.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 19, 2010 at 2:06 PM

Avanade , i am still having the same issue?

My questions?

1) I have system.data is something like this in my webconfig file..

<system.data>    

<DbProviderFactories>      

<add name="Entity Framework Data Provider" invariant="System.Data.EntityClient" type="System.Data.EntityClient.EntityProviderFactory, System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" description="Entity Framework Provider"></add>    

 </DbProviderFactories>

</system.data>

but my connectoinstring provider name is System.data.EntityClient? is that right? or should be System.data.SqlClient?

thanks

Oct 19, 2010 at 2:11 PM

That really depends on what you're really trying to use.  If you intend to use the provider for sql server, then you should use the SqlClient.  If it's the provider for entity framework, then it should be EntityClient.  I was really under the impression you want the EntityClient.

Take note that if you're going to use SqlClient, then there's no need for the DbProviderFactories configuration.

 

 

Oct 19, 2010 at 2:14 PM

Thanks Avanade. I added this line in my Confisection

<section name="typeRegistrationProvidersConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.TypeRegistrationProvidersConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

is this makes any differnece? bec I am still seeing same error..  I tried what ever you mensioned on the previous posts.. but no luck.. 

thanks

Oct 19, 2010 at 2:24 PM

That is only added if you're referencing the Microsoft.Practices.EnterpriseLibrary.Data assembly from GAC.  Have you tried the repro project I suggested? 

BTW, have you figured out what are you going to use, the SqlClient or EntityClient?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 19, 2010 at 2:24 PM

 

when I check in my debug mode.. 

 private static void LogException(Exception ex, ExceptionContext filterContext)        {
            var logEntry = MvcUnity.Container.Resolve<LogEntry>();            

logEntry.Title = filterContext.Exception.Message;          

 logEntry.Message = filterContext.Exception.ToString();          

 logEntry.AddErrorMessage("Source: " + ex.Source + "/r/nTarget: " + ex.TargetSite + "/r/nMessage: " +                                  

  ex.Message + "/r/nHelp Link: " + ex.HelpLink + "/r/n");          

 logEntry.AddErrorMessage("Stack Trace: /r/n" + ex.StackTrace + "/r/n");            

logEntry.AddErrorMessage("Data: /r/n" + ex.Data + "/r/n");            

logEntry.AddErrorMessage("Inner Exception: " + ex.InnerException + "/r/n");          

 Logger.Write(logEntry);      //// This Line If i click F11 its saying NO Source Available and I am getting error..   Writer = 'Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Writer' threw an exception of type 'Microsoft.Practices.ServiceLocation.ActivationException

 }

Oct 19, 2010 at 3:00 PM

Hello Avananda, 

this is the exact Error I am getting now.. 

Microsoft.Practices.ServiceLocation.ActivationException was unhandled by user code  Message=Activation error occured while trying to get instance of type LogWriter, key ""  Source=Microsoft.Practices.ServiceLocation  StackTrace:       at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 53       at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService]() in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 90       at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.get_Writer() in e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs:line 408       at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry log) in e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs:line 303       at NascoBenefitBuilder.Controllers.ControllerBase.LogException(Exception ex, ExceptionContext filterContext) in C:\BenefitBuilder\NascoBenefitBuilder\NascoBenefitBuilder\Controllers\ControllerBase.cs:line 454       at NascoBenefitBuilder.Controllers.ControllerBase.OnException(ExceptionContext filterContext) in C:\BenefitBuilder\NascoBenefitBuilder\NascoBenefitBuilder\Controllers\ControllerBase.cs:line 434       at System.Web.Mvc.Controller.System.Web.Mvc.IExceptionFilter.OnException(ExceptionContext filterContext)       at System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception)       at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)       at System.Web.Mvc.Controller.ExecuteCore()       at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)       at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)       at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__4()       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()       at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _)       at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.End()       at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult](IAsyncResult asyncResult, Object tag)       at System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag)       at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)       at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  InnerException: Microsoft.Practices.Unity.ResolutionFailedException       Message=Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", 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:
  Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl,LogWriter.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter, (none))  Resolving parameter "structureHolder" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder structureHolder, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider, Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator updateCoordinator)    Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,LogWriterStructureHolder.__default__ (mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder, (none))    Resolving parameter "traceSources" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.Filters.ILogFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] filters, System.Collections.Generic.IEnumerable`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] traceSourceNames, System.Collections.Generic.IEnumerable`1[[Microsoft.Practices.EnterpriseLibrary.Logging.LogSource, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]] traceSources, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource allEventsTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource notProcessedTraceSource, Microsoft.Practices.EnterpriseLibrary.Logging.LogSource errorsTraceSource, System.String defaultCategory, System.Boolean tracingEnabled, System.Boolean logWarningsWhenNoCategoriesMatch, System.Boolean revertImpersonation)      Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogSource,General      Resolving parameter "traceListeners" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.LogSource(System.String name, System.Collections.Generic.IEnumerable`1[[System.Diagnostics.TraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] traceListeners, System.Diagnostics.SourceLevels level, System.Boolean autoFlush, Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider instrumentationProvider)        Resolving Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.ReconfigurableTraceListenerWrapper,Database Trace Listener (mapped from System.Diagnostics.TraceListener, Database Trace Listener)        Resolving parameter "wrappedTraceListener" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.ReconfigurableTraceListenerWrapper(System.Diagnostics.TraceListener wrappedTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator coordinator)          Resolving Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener,Database Trace Listener‌implementation (mapped from System.Diagnostics.TraceListener, Database Trace Listener‌implementation)          Resolving parameter "database" of constructor Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener(Microsoft.Practices.EnterpriseLibrary.Data.Database database, System.String writeLogStoredProcName, System.String addCategoryStoredProcName, Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.ILogFormatter formatter)            Resolving Microsoft.Practices.EnterpriseLibrary.Data.Database,MiscEntities
       Source=Microsoft.Practices.Unity       TypeRequested=LogWriter       StackTrace:            at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\UnityContainer.cs:line 515            at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\UnityContainer.cs:line 485            at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\UnityContainer.cs:line 173            at Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(Type serviceType, String key) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\UnityServiceLocator.cs:line 64            at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key) in c:\Home\Chris\Projects\CommonServiceLocator\main\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs:line 49       InnerException: System.InvalidOperationException            Message=The type Database cannot be constructed. You must configure the container to supply this value.            Source=Microsoft.Practices.Unity            StackTrace:                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\DynamicMethod\Creation\DynamicMethodConstructorStrategy.cs:line 289                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\DynamicMethod\Creation\DynamicMethodConstructorStrategy.cs:line 71                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\StrategyChain.cs:line 110                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\DynamicMethod\DynamicMethodBuildPlanCreatorPolicy.cs:line 48                 at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\BuildPlanStrategy.cs:line 37                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\StrategyChain.cs:line 110                 at Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\BuilderContext.cs:line 220                 at Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\NamedTypeDependencyResolverPolicy.cs:line 51                 at BuildUp_Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener(IBuilderContext )                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\DynamicMethod\DynamicMethodBuildPlan.cs:line 37                 at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\BuildPlanStrategy.cs:line 43                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\StrategyChain.cs:line 110                 at Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\BuilderContext.cs:line 220                 at Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\NamedTypeDependencyResolverPolicy.cs:line 51                 at BuildUp_Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.ReconfigurableTraceListenerWrapper(IBuilderContext )                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\DynamicMethod\DynamicMethodBuildPlan.cs:line 37                 at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\BuildPlanStrategy.cs:line 43                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\StrategyChain.cs:line 110                 at Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\BuilderContext.cs:line 220                 at Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\NamedTypeDependencyResolverPolicy.cs:line 51                 at Microsoft.Practices.Unity.ResolvedArrayWithElementsResolverPolicy.DoResolve[T](IBuilderContext context, IDependencyResolverPolicy[] elementPolicies) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\ResolvedArrayWithElementsResolverPolicy.cs:line 73                 at Microsoft.Practices.Unity.ResolvedArrayWithElementsResolverPolicy.Resolve(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\ResolvedArrayWithElementsResolverPolicy.cs:line 64                 at BuildUp_Microsoft.Practices.EnterpriseLibrary.Logging.LogSource(IBuilderContext )                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\DynamicMethod\DynamicMethodBuildPlan.cs:line 37                 at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\BuildPlanStrategy.cs:line 43                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\StrategyChain.cs:line 110                 at Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\BuilderContext.cs:line 220                 at Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\NamedTypeDependencyResolverPolicy.cs:line 51                 at Microsoft.Practices.Unity.ResolvedArrayWithElementsResolverPolicy.DoResolve[T](IBuilderContext context, IDependencyResolverPolicy[] elementPolicies) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\ResolvedArrayWithElementsResolverPolicy.cs:line 73                 at Microsoft.Practices.Unity.ResolvedArrayWithElementsResolverPolicy.Resolve(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\ResolvedArrayWithElementsResolverPolicy.cs:line 64                 at BuildUp_Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(IBuilderContext )                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\DynamicMethod\DynamicMethodBuildPlan.cs:line 37                 at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\BuildPlanStrategy.cs:line 43                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\StrategyChain.cs:line 110                 at Microsoft.Practices.ObjectBuilder2.BuilderContext.NewBuildUp(NamedTypeBuildKey newBuildKey) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\BuilderContext.cs:line 220                 at Microsoft.Practices.Unity.ObjectBuilder.NamedTypeDependencyResolverPolicy.Resolve(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilderCustomization\NamedTypeDependencyResolverPolicy.cs:line 51                 at BuildUp_Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(IBuilderContext )                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\DynamicMethod\DynamicMethodBuildPlan.cs:line 37                 at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\BuildPlan\BuildPlanStrategy.cs:line 43                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\ObjectBuilder\Strategies\StrategyChain.cs:line 110                 at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) in e:\Builds\Unity\UnityTemp\Compile\Unity\Unity\Src\UnityContainer.cs:line 511            InnerException: 

Oct 19, 2010 at 3:31 PM

Hello Avananda, 

Here is my UnityRegistry class looks like this for my Ent lib..

 

//register all Enterprise classes and interfaces                

.AddNewExtension<EnterpriseLibraryCoreExtension>()              

 .RegisterType<LogEntry>(new InjectionConstructor());

Please let me know do I need to add more? here?

thanks

Oct 19, 2010 at 11:03 PM

What about the small project I was suggesting?  Did you try it?  If not, could you send me an email so I could send back a project I want you to try to run on your machine?

I'm not sure why are you registering the LogEntry class but the real issue is resolving an instance of LogWriter object. 

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com