那么,我们怎么在其它项目中调用这个方法呢,其实这和刚才我们所说的,调用天气的webservice是一个道理,首先,通过添加“web服务 引用”将,你写的webservice引用进来,我们需要注意的是其中有一处要我们填写请求webservice的URL地址,我们该怎么写?其实呢,也 很简单,就是,你将Service.asms在浏览器中浏览的地址,如我的是:http://www.easck.com/>
最后,再贴上代码:
?
- protected void Button1_Click(object sender, EventArgs e) {
- WebApplication1.localhost.WebService1 aa = new WebApplication1.localhost.WebService1(); this.Label1.Text = aa.GetSum(Convert.ToInt32(this.TextBox1.Text), Convert.ToInt32(this.TextBox2.Text)).ToString();
- }
以上就是关于C#调用WebService实例开发的全部内容,希望通过理论与实际的结合,对大家实现WebService调用有所帮助哦










