WCF DataService indent xml response

2019-09-05 05:14发布

问题:

How can i indent the xml response from my data service?

All my request to the wcf data service are in xml wihout indent.

I am using OData3 WCF Data Service 5.0.

Before in Odata WCF Dataservice 4, all my response data was in indent xml.

回答1:

It seems that since wcf dataservice 4.0 was update in WCF Data Services 5.0 with OData 3.0, all the xml response is not intent, i solved this by implement the IDispatchMessageInspector interface and modify the current content by xdocument and xmlTextwriter .