WCF will not return an int

前端 未结 3 1848
别跟我提以往
别跟我提以往 2020-12-06 19:52

I am building a WCF in C#, and a client to consume it at the same time. For some reason I am having trouble getting a method to return an int. Here is my contract:



        
3条回答
  •  情歌与酒
    2020-12-06 20:14

    You import it as a Service Reference (with name space MData) instead Web Reference.

    And use the below code,

    MDataClient m = new MDataClient(); 
    String helloWorld = m.HelloWorld(); 
    int result = m.ReturnAnInt();
    

    There is nothing wrong in your code. It should works fine if you add Service Reference and use the above snippet.

提交回复
热议问题