I have asp.net web site. I added reference of Microsoft.Practices.EnterpriseLibrary.Logging.dll
to the site.
in web.cofig file, I defined like below.
Your full config references trace listeners that are not defined. This is causing the Enterprise Library runtime to throw a runtime exception when it tries to resolve those references.
I commented out the unused listeners (and changed the default category to Important
) and it is working:
The clue is in the inner exception. At the end of the InnerException.Message
it says:
Resolving System.Diagnostics.TraceListener,Formatted EventLog TraceListener
The above config is in app.config. Then Program.cs contains:
class Program
{
static void Main(string[] args)
{
LogWriter logWriter = EnterpriseLibraryContainer.Current.GetInstance();
logWriter.Write("Test");
}
}