WCF will not return an int

前端 未结 3 1846
别跟我提以往
别跟我提以往 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:33

    I had a similar issue, I could not get an out int parameter of my web service to work. I am still not sure due to what this was exactly, but I had it working using a string as out parameter.

    [OperationContract]
    LoginStatus GetLogin(string username, string password, out string s_uId);
    

    on the web service side:

    s_uId = uId.ToString();
    

    on the client side:

    int uId;
    string s_uId;
    result = client.GetLogin(username, password, out s_uId);
    Int32.TryParse(s_uId, out uId);
    

提交回复
热议问题