开发者

webservice(.asmx) issue

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜