For a WCF service the exception 'System.ServiceModel.Diagnostics.PlainXmlWriter+MaxSizeExceededException' generally occurs when we switched on logging and tracing. A message was not logged. Exception: System.InvalidOperationException: There was an error generating the XML document. ---> System.ServiceModel.Diagnostics.PlainXmlWriter+MaxSizeExceededException: Exception of type 'System.ServiceModel.Diagnostics.PlainXmlWriter+MaxSizeExceededException' was thrown. The reason is that "maxSizeOfMessageToLog" configuration parameter value is set to a value lower than the size of the message to log. < system.serviceModel> < diagnostics > <!-- log all messages received or sent at the transport or service model levels --> < messageLogging logEntireMessage = " true " logMessagesAtServiceLevel = " true " logMalformedMessages = " true " logMessagesAtTransportLevel = " true " maxMessa...