1

I've a block of code

[ServiceContract]
public interface IService
{
    [OperationContract]
    [WebGet(
        ResponseFormat = WebMessageFormat.Json,
        RequestFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Bare,
        UriTemplate = "/projectSites")]
    IEnumerable<Web> GetProjectSites();
}

And the problem is that when I use

BodyStyle = WebMessageBodyStyle.Wrapped

I get good responce.. But when using

BodyStyle = WebMessageBodyStyle.Bare

I get an error

The server encountered an error processing the request. See server logs for more details.

What can wrong with it? I need exactly Bare style, as I ned to get responce of

{[{"description":"","id":"bb9effb4-27a8-4ad1-9513-5bccaa2eccfd","name":"s1","url":"http:smth"}]}

but not

{"GetProjectSitesResult":[{"description":"","id":"bb9effb4-27a8-4ad1-9513-5bccaa2eccfd","name":"s1","url":"http:smth"}]}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.