[英]WCF Client and Service Endpoints Using the Same Binding
我覺得這可能已經回答了,也許我沒有用正確的術語進行搜索。
我有一個像代理一樣的WCF服務。 這是兩個通常可以互相交流的服務的中間人,但現在可以通過這項新服務。
老:A - > B.
新:A - > MM - > B.
我需要公開與服務端點相同的合同(“A”與“MM”對話)和客戶端點(“MM”與“B”對話)。
這兩個可以共享綁定配置,只是給端點不同的名稱? 或者有更好的方法來處理這種情況嗎?
(在<system.serviceModel>
標簽內)
<client>
<endpoint address="http://<remoteaddress>/" binding="basicHttpBinding"
bindingConfiguration="MyBinding" contract="IService" name="ToB" />
</client>
<services>
<service behaviorConfiguration="Behavior" name="Service">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="MyBinding" name="FromA" contract="IService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/MyService" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="MyBinding" closeTimeout="00:15:00" openTimeout="00:15:00"
receiveTimeout="00:15:00" sendTimeout="00:15:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2048000000" maxBufferPoolSize="2048000000"
maxReceivedMessageSize="2048000000" messageEncoding="Text"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="4065536" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
編輯:
此設置的錯誤消息是:
com.vsp.cal.webservice.external.SystemFault
堆棧:服務器堆棧跟蹤:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
名稱的更改不足以唯一地定義端點。 而是回到舊的“ABC” - 地址,約束,合同。 其中至少有一個必須不同才能唯一地定義新端點。 http://msdn.microsoft.com/en-us/library/ms733107(v=vs.100).aspx
這有幫助嗎?
感謝所有看過這個並試圖提供幫助的人!
最后,它不是配置,而是一個愚蠢的編碼錯誤。 隱秘的錯誤消息是來自另一方的響應(Java Web服務)。 它不高興,因為我因為失敗的演員而發送了一個空對象。
所以答案是,當你不像白痴一樣編碼時,這種配置會起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.