ich eine Klasse als eine Antwort in MVC Web-API XMLFormatter serialisiert werden will, aber ich erhalte die folgende Ausnahme, während die resonse erstellen:XML-Serialisierung kann nicht ein Objekt des Typs schreiben ‚x‘
MediaTypeFormatter formatter = Configuration.Formatters.XmlFormatter;
HttpResponseMessage resp = Request.CreateResponse<Model>(HttpStatusCode.OK, value: modelObject, formatter: formatter);
Die Ausnahme:
The configured formatter 'System.Web.Http.Tracing.Tracers.XmlMediaTypeFormatterTracer' cannot write an object of type 'Model'.
Was ist los?
Gespeichert mich Stunden des Suchens. Einfache Dinge wie diese. :-) Vielen Dank! –