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> 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章