C# 添加服务引用。
1,服务引用给的实例(需要一个网址连接)
http://192.168.17.131:12170/amtiot.gis.WCF/SpatialAnalysis.svc (类似于这样的一个网址)
在网络里面打开后的截图:
2,在vs中新建一个c#工程,添加服务引用,将地址粘贴如下图点击前往后即可使用(命名空间可以根据自己的需求更改)
添加完成后:
3,使用代码中只有带标号的四句话是添加的。
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using tt.ServiceReference1; //1 namespace tt { static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { SpatialAnalysisClient client = new SpatialAnalysisClient(); //2 ServiceReference1.BoundaryInfo result = client.GetBoundaryWithSensorWidth("S535100031", "2015-06-11 13:00:00", "2015-06-11 13:35:00", false); //3 client.Close(); //4 Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }