Enterprise Library 5.0 - Logging to Database - The type LogWriter does not have an accessible constructor

I'm trying to log messages to a database using Enterprise Library 5.0 but I'm running into couple of errors. I'm not sure if I'm missing anything here or doing something wrong. If anyone can help, I would really appreciate it. I'm in my 2nd day of trying
to figure this out.

Sorry about the long post - I hope it helps others.

The Errors:

Activation error occurred while trying to get instance of type LogWriter, key \"\"

I took all of the code and configuration you posted and created a console application in VS2012 targeting .NET 4.5. The only changes were that I changed the database connection information. The sample application runs fine.

The exception you are seeing usually indicates that there is an issue with configuration.

What type of application are you working with? Since you've already answered most of the questions that I would ask it might be easier to create a sample application that recreates the issue.

I am building an MVC application with two projects in my solution. The first project is a class library and the second is the website. I am trying the logging code in the class library. Both projects have the Enterprise Library references but my web project
is not referencing the entlib.config file. Only the class library is through the app.config.

OK, that helps. The configuration needs to go in the web.config of the MVC project instead of the app.config of the Class Library. If you do that then you should be OK.

Also, just be aware that in Enterprise Library 5.0.414.0 there is a
bug with FileConfigurationSource resolving relative paths. You should be OK since you are using an absolute path but just a heads up in case you decide to change. This issue was fixed in
Enterprise Library 5.0 Optional Update 1.

Awesome! It's working and I'm able to see logs in my database. Thanks for your help, Randy! Also, thanks for the relative path bug information.

Here's what I had to do in addition to what I posted earlier to get this working:

Before all of this started, I downloaded and installed the Enterprise Library MSI which installed all the necessary DLLs under
C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin directory. Then I went in Visual Studio and added the references to my projects using NuGet. However, NuGet creates references to the DLLs that are under the
packages folder in the root directory of the project. This resulted in a manifest error during compilation.

I had to uninstall all Enterprise Library DLLs through NuGet to remove all references from my projects and then I added each DLL under
C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin manually to my projects. This resolved the manifest issue for me.

Finally, I ended up removing IntegratedSecurity=SSPI; from my connection string. This was preventing the application from connecting to the database. Once I removed it, I was able to see the logs in the database. Also, I changed
User to User Id.