"The type Database cannot be constructed. You must configure the container to supply this value."
-
Thursday, March 17, 2011 1:22 PM
I am trying to implement Exception Handling Application Block.
For some reason, the system returns the following message when the exception logging gets called: "The type Database cannot be constructed. You must configure the container to supply this value." Do you have any idea what might be causing this? My App.config file is below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
<section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<connectionStrings>
<add name="ApplicationServices" connectionString="Server=tcp:ygw46rq43r.database.windows.net,1433;Database=TSOMEMBERSHIP;User ID=TSOlutionsAdmin;Password=pa55_w0rd;Trusted_Connection=False;Encrypt=True;" providerName="System.Data.SqlClient"/>
<add name="LoggingDB" connectionString="Server=tcp:ygw46rq43r.database.windows.net,1433;Database=Logging;User ID=TSOlutionsAdmin;Password=pa55_w0rd;Trusted_Connection=False;Encrypt=True;" providerName="System.Data.SqlClient" />
</connectionStrings>
<dataConfiguration defaultDatabase="LoggingDB" />
<unity configSource="Config\Unity.config" />
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
<listeners>
<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="LoggingDB" writeLogStoredProcName="WriteLog"
addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
</listeners>
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
template="Title:{tab}{tab}{title}{newline}&#xA;Timestamp:{tab}{tab}{timestamp}{newline}{dictionary({key}:{tab}{value}{newline})}Category:{tab}{tab}{category}{newline}Priority:{tab}{tab}{tab}{priority}{newline}EventId:{tab}{tab}{tab}{eventid}{newline}Severity:{tab}{tab}{tab}{severity}{newline}Machine:{tab}{tab}{machine}{newline}AppDomain:{tab}{tab}{appDomain}{newline}ProcessID:{tab}{tab}{processId}{newline}ProcessName:{tab}{tab}{processName}{newline}ThreadID:{tab}{tab}{win32ThreadId}{newline}ThreadName:{tab}{tab}{threadName}{newline}{newline}***********************************************************************************************{newline}<FormattedMessage><Timestamp>{timestamp}</Timestamp><Message>{message}</Message><Category>{category}</Category><Priority>{priority}</Priority><EventId>{eventid}</EventId><Severity>{severity}</Severity><Title>{title}</Title><Machine>{machine}</Machine><AppDomain>{appDomain}</AppDomain><ProcessID>{processId}</ProcessID><ProcessName>{processName}</ProcessName><ThreadID>{win32ThreadId}</ThreadID><ThreadName>{threadName}</ThreadName><ExtendedProperties>{dictionary(<key>{key}</key><value>{value}</value>)}</ExtendedProperties></FormattedMessage>"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Database Trace Listener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Database Trace Listener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
<exceptionHandling>
<exceptionPolicies>
<add name="General">
<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, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
priority="0" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
<add name="GeneralWarning">
<exceptionTypes>
<add name="All Exceptions" type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
postHandlingAction="NotifyRethrow">
<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="Category 2" eventId="100" severity="Warning" title="Enterprise Library Exception Handling"
formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
priority="0" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
</configuration>- Moved by Esther FanMicrosoft Employee Tuesday, June 07, 2011 6:28 PM (From:Architecture General)
All Replies
-
Friday, June 03, 2011 6:30 AMEven I'm getting same problem. Have you got a resolution?. I'm getting this problem with Emterprise library 5.0
-
Thursday, June 09, 2011 2:47 PMsame error here......is there any solution?
Regards, Rama -
Tuesday, August 09, 2011 8:56 AMI get the same error even when trying Data Access examples.
-
Friday, March 16, 2012 9:03 AMnow i also get this error! waiting....
-
Wednesday, April 04, 2012 6:02 PM
Hi Esther,
Please check this link:
http://entlib.codeplex.com/discussions/267817ck t
Regards, http://shwetamannjain.blogspot.com
- Proposed As Answer by Shweta Jain Wednesday, April 04, 2012 6:02 PM

