Last post Jan 04, 2011 09:36 AM by dionisifam
Nov 19, 2010 05:04 AM|Frenz|LINK
I have a Solution which contains a Web project and a Class Library project. The Class library project contains Enterprise library 5.0 and app.config. When I try to perform a Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write, I get the following
Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "(none)". Exception occurred while: while resolving. Exception is: InvalidOperationException - The type LogWriter 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.LogWriter,(none)
If I move all the class files to the web project and have the Enterprise library configuration in the Web.config, everything works fine. I guess the issue is that the Enterprise library is not detecting the app.config which contains all the configuration.
How can I have my enterprise library use the App.config present in its prroject.
Kindly help me with this regard.
Thanks in advance.
Nov 19, 2010 10:43 AM|DarrellNorton|LINK
You need to add a few settings in the web.config to point to an external (non web.config) config file:
Jan 04, 2011 09:36 AM|dionisifam|LINK
I have the
the configuration file
Dim container As New UnityContainer
Dim configurator = New UnityContainerConfigurator(container)
' Read the configuration files and set up the container.
EnterpriseLibraryContainer.ConfigureContainer(configurator, New FileConfigurationSource("file.config"))
_LogWriter = container.Resolve(Of LogWriter)()
' add custom listener to logWriter
If IsLogging Then
Dim collList As New List(Of TraceListener)
Dim dbTraceList As TraceListener = Nothing
Dim dblogSource As LogSource = Nothing
dbTraceList = New SIALogListener(_connLog, _databaseLog)
dblogSource = New LogSource("CustomDBLog", collList, SourceLevels.All)
dblogSource.AutoFlush = True
works perfectly. NET
mode is evident
me is that
dll in a
only in the