我最近被要求連接到第三方Web服務(* .asmx)。我創建了一個新的ASP.NET網站,並使用該向導來創建服務引用。當我去調用服務時,代碼抱怨說它不知道要使用哪個端點。請幫助菜鳥瞭解服務參考綁定
我查看了Web.config,果然,嚮導創建了TWO綁定,因此創建了兩個端點。通過將任一端點添加到服務調用中,一切都可以正常工作。
那麼我的問題只是爲了幫助我理解爲什麼我有兩個綁定,並且如果有什麼理由我應該使用另一個呢?或者我應該刪除一個,如果是,哪個?
綁定看起來完全不同於我,我假設有兩個不同的協議正在使用(但它們都被標記爲SOAP,所以..)。我非常「專注於前端」,並且不經常涉足後端機制,這就是爲什麼我要問。我會在下面發佈綁定。
<bindings>
<basicHttpBinding>
<binding name="ServiceSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="ServiceSoap12">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://someURL.asmx" binding="basicHttpBinding"
bindingConfiguration="ServiceSoap" contract="ServiceReference.ServiceSoap"
name="ServiceSoap" />
<endpoint address="http://someURL.asmx" binding="customBinding"
bindingConfiguration="ServiceSoap12" contract="ServiceReference.ServiceSoap"
name="ServiceSoap12" />
</client>
您可以詢問提供程序端點之間的區別是什麼? – Dave 2012-02-15 21:56:24