Silverlight is running in a sandbox, the Silverlight LogEntry object does not support the following properties which are also NOT NULL
in the Logging Database Schema:
- MachineName
- ProcessID
- ProcessName
This seems to be an oversight when using Silverlight logging combined with the DatabaseTraceListener.
There are 2 options to overcome this: modify the [Log] database table to allow the MachineName, ProcessID, and ProcessName columns to allow NULLs or
create a service which sets those values to be empty string instead.
The service is quite simple and would look like this:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class DatabaseLoggingService : LoggingService { /// <summary> /// Translates the incoming <see cref="LogEntryMessage"/> into a <see cref="LogEntry"/>. /// </summary> /// <param name="entry">The log entry coming from the client.</param> /// <returns>A <see cref="LogEntry"/> instance that can be stored in the log.</returns> protected override LogEntry Translate(LogEntryMessage entry) { var logEntry = entry.ToLogEntry(); if (logEntry.MachineName == null) logEntry.MachineName = string.Empty; if (logEntry.ProcessId == null) logEntry.ProcessId = string.Empty; if (logEntry.ProcessName == null) logEntry.ProcessName = string.Empty; return logEntry; } }