C# WCF restful SharePoint web服务(WebMessageBodyStyle.Bare)
我有一段代码C# WCF restful SharePoint web服务(WebMessageBodyStyle.Bare),c#,json,wcf,sharepoint,C#,Json,Wcf,Sharepoint,我有一段代码 [ServiceContract] public interface IService { [OperationContract] [WebGet( ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate
[ServiceContract]
public interface IService
{
[OperationContract]
[WebGet(
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "/projectSites")]
IEnumerable<Web> GetProjectSites();
}
我的反应很好。。
但是当使用
BodyStyle = WebMessageBodyStyle.Bare
我犯了一个错误
服务器在处理请求时遇到错误。有关详细信息,请参阅服务器日志
它有什么毛病?我需要赤裸裸的风格,因为我需要得到回应
{[{"description":"","id":"bb9effb4-27a8-4ad1-9513-5bccaa2eccfd","name":"s1","url":"http:smth"}]}
但不是
{"GetProjectSitesResult":[{"description":"","id":"bb9effb4-27a8-4ad1-9513-5bccaa2eccfd","name":"s1","url":"http:smth"}]}
{"GetProjectSitesResult":[{"description":"","id":"bb9effb4-27a8-4ad1-9513-5bccaa2eccfd","name":"s1","url":"http:smth"}]}