开发者

webservice(.asmx) issue

开发者 https://www.devze.com 2022-12-11 08:51 出处:网络
i have a webmethod 开发者_开发技巧in my webservice public class Service : System.Web.Services.WebService

i have a webmethod 开发者_开发技巧in my webservice

public class Service : System.Web.Services.WebService
{

    [WebMethod]
    public int ADD(int a,int b )
    {
        return a+b;
    }

}

i need to implement it in a windowapplication which contain a textbox .i added webreference there with foldername "localhost" and URL as "http://localhost:4484/WebSite2/Service.asmx"

using WindowsApplication4.localhost;

   localhost.Service s = new Service();
    s.ADD(12,34);
    textBox1.Text = s.ToString();

but i am getting result as "WindowsApplication4.localhost.Service" instead of "46" Can any one tell me the reason for this


Shouldn't

s.ADD(12,34);
textBox1.Text = s.ToString(); 

be

textbox1.Text = s.ADD(12, 34).ToString(); ?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号