WCF Service Proxy throws exception when more than one parameter is used in [OperationContract] method

后端 未结 4 1058
忘了有多久
忘了有多久 2020-12-10 06:12

I have a WebServiceHost that is being used to host some web services in a console app. I added a service reference to it in my client app and create the proxy like so:

4条回答
  •  温柔的废话
    2020-12-10 06:37

    I have another scenario for this issue, even if I added [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest)] on the Operation Contact Method, it still doesn't work, I found this post is resolve my problem. http://www.codemeit.com/wcf/wcf-restful-pox-json-and-soap-coexist.html

    What we need to do is simply locate the file “reference.cs” generated after adding service reference. Search keyword: “public interface ITestService” within the client project, you will find the generated service contract, add [System.ServiceModel.Web.WebGet] on top of the OperationContract.

    So I had had added [System.ServiceModel.Web.WebGet] on the top of OprationContract on the proxy class of client side, it works.

提交回复
热议问题