سؤال

I recently found a 6 part article series on logging in MVC over at Darren's Blog (http://dotnetdarren.wordpress.com/).

It is a very good article on how to use Elmah, Log4Net, NLog, and Health Monitoring AND use a single UI to view and manage entries.

The article was written back in 2010, but I have successfully implemented it on an MVC 4 application that I am developing. The logging is working perfectly, but I do have an issue when trying to view entries in the combined UI.

I get the following error:

"System.Data.SqlClient.SqlException: Cannot resolve collation conflict for DISTINCT operation."

If I comment out the configuration entry for Log4Net, I do not get the error any longer and I am able to see entries for Elmah and Health Monitoring. This error only occurs when trying to UNION in the entries from the Log4Net table.

Anyone have any ideas on how to resolve this?

Thanks in advance for any help.

UPDATE: Here is the code (VB.NET) where the problem occurs:

For Each providerName As String In logProviders.Keys
    Dim logList As IQueryable(Of LogEventModel) = GetProvider(providerName).GetByDateRangeAndType(pageIndex, pageSize, startDate, endDate, logLevel)
    ' Error occurs on this line below, only when Log4Net is in use.
    list = If((list Is Nothing), logList, list.Union(logList))
Next
هل كانت مفيدة؟

المحلول

I've had the same problem (with the same blog series) If you haven't found a solution yet, here's what helped me :

Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation

Cheers

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top