WCF Configuration Hell?

前端 未结 7 939
一生所求
一生所求 2021-02-08 01:07

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:38

    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);
    

提交回复
热议问题