WebService 错误:无法加载协定为xxx的终结点配置部分,因为找到了该协定的多个终结点配置

 

 

原因是在webconfig中包含多个endpoint ,绑定对应的节点或者删除不用的即能解决这个问题

  
  
  
  
  1. WeatherWSSoapClient wwc = new WeatherWSSoapClient("WeatherWSSoap"
  
  
  
  
  1. <configuration> 
  2.     <system.web> 
  3.         <compilation debug="true" targetFramework="4.0" /> 
  4.     </system.web> 
  5.  
  6.     <system.serviceModel> 
  7.         <bindings> 
  8.             <basicHttpBinding> 
  9.                 <binding name="WeatherWSSoap" closeTimeout="00:01:00" openTimeout="00:01:00" 
  10.                     receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" 
  11.                     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
  12.                     maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
  13.                     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
  14.                     useDefaultWebProxy="true"> 
  15.                     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
  16.                         maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
  17.                     <security mode="None"> 
  18.                         <transport clientCredentialType="None" proxyCredentialType="None" 
  19.                             realm="" /> 
  20.                         <message clientCredentialType="UserName" algorithmSuite="Default" /> 
  21.                     </security> 
  22.                 </binding> 
  23.             </basicHttpBinding> 
  24.             <customBinding> 
  25.                 <binding name="WeatherWSSoap12"> 
  26.                     <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" 
  27.                         messageVersion="Soap12" writeEncoding="utf-8"> 
  28.                         <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
  29.                             maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
  30.                     </textMessageEncoding> 
  31.                     <httpTransport manualAddressing="false" maxBufferPoolSize="524288" 
  32.                         maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" 
  33.                         bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard" 
  34.                         keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" 
  35.                         realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" 
  36.                         useDefaultWebProxy="true" /> 
  37.                 </binding> 
  38.             </customBinding> 
  39.         </bindings> 
  40.         <client> 
  41.             <endpoint address="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx" 
  42.                 binding="basicHttpBinding" bindingConfiguration="WeatherWSSoap" 
  43.                 contract="ServiceReference1.WeatherWSSoap" name="WeatherWSSoap" /> 
  44.             <endpoint address="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx" 
  45.                 binding="customBinding" bindingConfiguration="WeatherWSSoap12" 
  46.                 contract="ServiceReference1.WeatherWSSoap" name="WeatherWSSoap12" /> 
  47.         </client> 
  48.     </system.serviceModel> 
  49. </configuration> 

 

你可能感兴趣的:(WebService 错误:无法加载协定为xxx的终结点配置部分,因为找到了该协定的多个终结点配置)