Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry' to type 'Kigg.Infrastructure.EnterpriseLibrary.WeblogEntry'

Jul 27, 2009 at 3:54 PM

Hello

I've just install KIGG, but it doesn't work correctly. 

This exception is occured, when KIGG try to send mail.

 

System.InvalidCastException was unhandled by user code
  Message="Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry' to type 'Kigg.Infrastructure.EnterpriseLibrary.WeblogEntry'."
  Source="Kigg.Infrastructure.EnterpriseLibrary"
  StackTrace:
       at Kigg.Infrastructure.EnterpriseLibrary.WeblogTraceTextFormatter.b__0(LogEntry le) in C:\_Projects\KiGG\EnterpriseLibrary\Logging\WeblogTraceTextFormatter.cs:line 29
       at Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.GenericTextFormatter`1.Format(T instance, StringBuilder output)
       at Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter.Format(LogEntry log)
       at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
       at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
       at Microsoft.Practices.EnterpriseLibrary.Logging.LogSource.TraceData(TraceEventType eventType, Int32 id, LogEntry logEntry, TraceListenerFilter traceListenerFilter)
       at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.ProcessLog(LogEntry log)
  InnerException: 

Did anybody get this exception? Any solutions?

 

 

Coordinator
Jul 27, 2009 at 4:00 PM

I got this exception too since the release of v2.2. No fix yet posted. I think I will look at it during this week.

Coordinator
Jul 27, 2009 at 10:58 PM

I figured out the reason, it is a configuration issue.

I will commit a fix for this issue soon and will be included as part of KiGG-v2.5

To quickly help you resolve this issue do the following:

  1. Open web.config for editing
  2. Under loggingConfiguration element find categorySources element.
  3. Under categorySources element find the added listeners and remove this line from listeners <add name="CsvFileListener"/>

Run the application again. if you didn't configure your mail server properly you'll find an error logged of course but no more the exception metioned above will be logged.

Let me know if this worked for you.

Coordinator
Jul 27, 2009 at 11:02 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.