私はasp.net Web APIにいます。API メソッドで、XML 応答を返す外部 Web サービスを呼び出しています。私はそれをデシリアライズしたくありません。そのままクライアントに送りたいと思います。最初は、応答をXDocumentオブジェクトに保存していますが、クライアントapplication/xmlが受け入れヘッダーとして指定すると、次の例外が表示されます
Type 'System.Xml.Linq.XDeclaration' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
この問題を回避するにはどうすればよいですか