I'm building a WCF service that will expose BasicHttp and NetTcp bindings. I've also added two corresponding Mex endpoints, i.e.
<service name="WCFTest.CalculatorService" behaviorConfiguration="WCFTest.CalculatorBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8000/WCFTest/CalculatorService/" />
<add baseAddress = "net.tcp://localhost:9000/WCFTest/CalculatorService/" />
</baseAddresses>
</host>
<endpoint address ="basicHttpEP" binding="basicHttpBinding" contract="WCFTest.ICalculatorService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address ="netTcpEP" binding="netTcpBinding" contract="WCFTest.ICalculatorService"/>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
Do I really need to add a NetTcp Mex endpoint as well as an BasicHttp Mex endpoint? Will clients not just always use the Http mex endpoint for meta data disocvery regardless of whether they're going to communicate using tcp or not?
Thanks
Sometimes in our mind the question arise; can we implement multiple service contract in WCF service? And the answer is, Yes we can. Service class implement multiple service interfaces, and then expose each service using a different endpoint.
The first endpoint is defined at the base address using a basicHttpBinding binding, which does not have security enabled. The second endpoint is defined at {baseaddress}/secure using a wsHttpBinding binding, which is secure by default, using WS-Security with Windows authentication.
MEX endpoints are special endpoints that allow clients to receive the service's metadata by using SOAP messages instead of only http get requests(ie httpGetEnabled="true").
All communication with a Windows Communication Foundation (WCF) service occurs through the endpoints of the service. Endpoints provide clients access to the functionality offered by a WCF service. Each endpoint consists of four properties: An address that indicates where the endpoint can be found.
Yes, you can use just the HTTP mex endpoint. I think the assumption is that your client can communicate over HTTP.
No, the assumption in your code is that the communication channel can either http or net tcp.
If you don't declare both that means you are restricting the service / client to communicate over only one binding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With