wcf - How is the Binding done when specifying multiple Base Address -
i have wcf service has it's configuration file specified below:
<system.servicemodel> <services> <service name="wcfservice.serviceclass" behaviorconfiguration="metadatasupport"> <host> <baseaddresses> <add baseaddress="net.pipe://localhost/wcfservice"/> <add baseaddress="net.tcp://localhost:8100/wcfservice"/> <add baseaddress="http://localhost:8101/wcfservice"/> </baseaddresses> </host> <endpoint address="tcpmex" binding="mextcpbinding" contract="imetadataexchange" /> <endpoint address="namedpipemex" binding="mexnamedpipebinding" contract="imetadataexchange" /> <endpoint address="" binding="wshttpbinding" contract="wcfservice.iserviceclass" /> </service> </services> <behaviors> <servicebehaviors> <behavior name="metadatasupport"> <servicemetadata httpgetenabled="false" httpgeturl="" /> </behavior> </servicebehaviors> </behaviors> </system.servicemodel>
i have 3 types of binding here: namedpipebinding, tcpbinding , wshttpbinding.
i can add together reference metadata @ next location
net.tcp://localhost:8100/wcfservice/tcpmex
net.pipe://localhost/wcfservice/namedpipemex
i have disabled httpget service in behavior.
the service reference added but next configuration @ client:
<system.servicemodel> <bindings> <wsdualhttpbinding> <binding name="wshttpbinding_iserviceclass" /> </wsdualhttpbinding> </bindings> <client> <endpoint address="http://localhost:8101/wcfservice" binding="wshttpbinding" bindingconfiguration="wshttpbinding_iserviceclass" contract="tcp.iserviceclass" name="wshttpbinding_iserviceclass"> </endpoint> </client> </system.servicemodel>
but since added reference using tcp binding endpoint, expected :
address=net.tcp://localhost:8100/wcfservice
and binding="mextcpbinding"
the service working know, what's going on here. reason this. due baseaddress or preference given wshttpbinding?
thoughts appreciated.
thanks.
the mex
binding (short metadata exchange) not endpoint can used consume service. instead, it's used used expose info (or meta information) "real" endpoints of service - notice service class doesn't implement imetadataexchange
contract defined in tcp/pipe endpoints.
in case, service has 1 "real" endpoint - 1 using wshttpbinding
, implements wcfservice.iserviceclass
interface. that's why there's 1 endpoint in client configuration.
now, if had endpoint using non-metadata binding (and not imetadataexchange
contract), show in client config well:
<system.servicemodel> <services> <service name="wcfservice.serviceclass" behaviorconfiguration="metadatasupport"> <host> <baseaddresses> <add baseaddress="net.pipe://localhost/wcfservice"/> <add baseaddress="net.tcp://localhost:8100/wcfservice"/> <add baseaddress="http://localhost:8101/wcfservice"/> </baseaddresses> </host> <endpoint address="tcpmex" binding="mextcpbinding" contract="imetadataexchange" /> <endpoint address="namedpipemex" binding="mexnamedpipebinding" contract="imetadataexchange" /> <endpoint address="" binding="netnamedpipebinding" contract="wcfservice.iserviceclass" /> <endpoint address="" binding="nettcpbinding" contract="wcfservice.iserviceclass" /> <endpoint address="" binding="wshttpbinding" contract="wcfservice.iserviceclass" /> </service> </services> <behaviors> <servicebehaviors> <behavior name="metadatasupport"> <servicemetadata httpgetenabled="false" httpgeturl="" /> </behavior> </servicebehaviors> </behaviors> </system.servicemodel>
wcf binding
No comments:
Post a Comment