WCF Configuration Hell?

前端 未结 7 786
迷失自我
迷失自我 2021-02-08 01:20

I hate WCF setup with endpoints, behaviors etc. I believe all these things should be performed automatically. All I want to do is to return JSON result from my WCF service. Here

7条回答
  •  长发绾君心
    2021-02-08 01:36

    In your WebGet or WebInvoke Specify your BodyStyle to WrappedRequest, then remove the UriTemplate. When Invoking your service use the function name.

    Hope it helps.

    Example:

        [OperationContract]
        [WebInvoke(Method = "POST",
            BodyStyle = WebMessageBodyStyle.WrappedRequest,
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json)]
        void register(string name, string surname);
    

提交回复
热议问题