Вопрос

We have set up log4net within our current project to use the AdoNetAppender to write log entries to a SQL Server database. This all works correctly, but for some reason in order to get it working we have to set Copy Local to true on System.Data.dll - if this DLL isn't present in the bin directory then log4net won't output to SQL Server and will throw an error about the missing DLL.

Is this a bug in log4net? I would assume that since System.Data.dll is a .Net framework component that log4net would be able to find it in the GAC.

For reference, we're using log4net 1.2.10.0 and .Net 4.5

EDIT - For better readability if anyone else comes across this issue, the original XML config I was using defined the connectionType as:

<connectionType value="System.Data.SqlClient.SqlConnection, System.Data" />

Changing it to the following fixed the issue.

<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Это было полезно?

Решение

Can you try this? I'm not sure what version of System.Data is for .NET 4.5, but anyways this should work:

<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top