C#调用webservice 不用默认配置文件 直接在构造函数配置地址
ClientBase(Binding binding, EndpointAddress remoteAddress) 这个重载更好用,都不用填名称
例如 获取随机汉字
http://www.webxml.com.cn/WebServices/RandomFontsWebService.asmx
ServiceReference1.RandomFontsWebServiceSoap d =
new ServiceReference1.RandomFontsWebServiceSoapClient(
new BasicHttpBinding(),
new EndpointAddress("http://www.webxml.com.cn/WebServices/RandomFontsWebService.asmx")
);
string[] arr = d.getChineseFonts(5);
文章来源 https://www.cnblogs.com/longling2344/p/6255846.html
浙公网安备 33010602011771号