WCF SOAP用法

it2022-06-23  84

基本思路

1、新建一个WCF服务库2、在客户端引用处右键,添加服务引用

 

点击发现,选择目标服务设置好命名空间

 

可以在高级一栏里面,设置详细信息

 

点击确认,添加服务引用

 

3、在客户端自动生成XXXClient类,可以直接调用服务的方法例子服务器

[OperationContract] string GetData(int value); public string GetData(int value) { return string.Format("You entered: {0}", value); }

客户端

ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(); string result= client.GetData(1);

4、在添加服务引用之后,服务有所更新(新增、删除、修改方法),更新服务引用即可当然也可以删去并重新引用服务

   

转载于:https://www.cnblogs.com/Lulus/p/7873052.html

相关资源:数据结构—成绩单生成器

最新回复(0)