通过脚本调用:
添加新项->Web服务(WebService.asmx)
在WebService.cs中添加方法(简单加法)Add(int a,int b)
代码:
[WebMethod]
public int Add(int a,int b) {
return a+b;
}
保存
在WebPage(Default.aspx)中调用
先添加web引用->此解决方案中的Web服务->添加WebService.asmx引用(引用名;testWebService)
在Default.aspx中的添加TextBox1,TextBox2,label1,button1
testWebService.WebService test=new testWebService();
int a=Convert.ToInt32(TextBox1.text);
int b=Convert.ToInt32(TextBox2.text);
int c;
c=test.Add(a,b);
label1.text=c.toString();
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。