环境:windows8+vs2010+vb.net+winform
类库中引用 webservice 服务后,直接调用时会碰到如下的错误:
在 ServiceModel 客户端配置部分中,找不到引用协定“WebServiceForSanYou.TosServiceSoap”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为
解决方案:
1)在类库里引用服务时,会产生 app.config 文件
2)将上述文件中如下部分复制到 主程序的 app.config 中。(注意 endpoint 节只保留一个)
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="TosServiceSoap" />
</basicHttpBinding>
<customBinding>
<binding name="TosServiceSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</