webService 的一点总结

建立一个webservice 工程时,对于不同的项目加入webservice后的效果是不一样的(引用的界面也有不一样)

请看下图:

1 ,Window From 的web Service  (Console和winForm一样)

对webService 的一点总结

2,Web Site  的(请注意的Web Application的它有所不同 ,和Windows Form 有很相同之处)

对webService 的一点总结

3,SilverLight 工程的:产生的Reference配置文件名:ServiceReferences.clientconfig

对webService 的一点总结

下面给出

修改URL的类:

using System;

using System.Collections.Generic;//这个是泛空间

using System.Linq;

using System.Text;

using System.ServiceModel;//这个空间

namespace ConsoleApplication1 {

class changeService {

  public changeService() { }

  public string getHellow() { BasicHttpBinding bing = new BasicHttpBinding();//可以不为, 这里只是说明乍么去调用

  EndpointAddress endpoint = new System.ServiceModel.EndpointAddress("http://127.0.0.1/testWebService/myWebService.asmx");

  //EndpointAddress endpoint = new System.ServiceModel.EndpointAddress("http://localhost:49161/myWebService.asmx");

  webService.Service1SoapClient myTestService = new ConsoleApplication1.webService.Service1SoapClient("Service1Soap", endpoint); //return myTestService //这里可以直接返回调用的远程服器对象 ,以便主程序中运用

异步调用产生对象时也可以这样来调用.

   return myTestService.HelloWorld();

  }

 }

}

相关文章:

  • 2022-12-23
  • 2021-08-13
  • 2021-08-08
  • 2021-06-13
  • 2022-03-01
  • 2022-02-24
  • 2021-12-05
猜你喜欢
  • 2022-03-03
  • 2021-09-19
  • 2021-11-23
  • 2022-12-23
  • 2021-07-13
  • 2021-09-10
相关资源
相似解决方案