What is "mexHttpBinding" in WCF? When should this binding be used in preference to other bindings?
3 Answers
It is a binding that returns metadata so you can build a proxy at the client side. See here. More here as well.

- 73,752
- 17
- 161
- 228
-
2So are there two endpoints in a WCF service - the standard one and a metadata endpoint? – Craig Schwarze Jan 21 '10 at 03:10
-
11You can have any number of endpoints for the same contract, among them mexHttpBinding that provides metadata and in most cases is disabled when in production. – Otávio Décio Jan 21 '10 at 03:11
-
1There can be many different endpoints in a WCF service, with different kinds of bindings and different addresses. – codekaizen Jan 21 '10 at 03:11
-
So metadata endpoints are identified by having an address of "mex"? – Craig Schwarze Jan 21 '10 at 03:16
-
metadata endpoints can have whatever address you give them ("mex", "foo", "bar", etc.) the fact the you assigned them a mex binding is what determines that it's a metadata endpoint – Travis Heseman Jan 21 '10 at 03:20
-
2@CraigS: the Metadata exchange endpoints are those with a contract of `IMetadataExchange` - that's the ultimate deciding factor. It's a system contract that WCF provides for metadata exchange. The address is totally irrelevant, "mex" is just a commonly used best practice, but not a requirement by any means – marc_s Jan 21 '10 at 06:27
mexHTTPBinding allows to use WS-MetadataExchange over HTTP. You don't need it unless you implemented policies which may change over time and you need to discover your service with UDDI for example
Many people says it's needed for creating client side proxies. This is not true. For client side proxies you need to publish WSDL. You can do that by specifying in your service behavior.
Shortly, you don't know it -> you don't need it.

- 1,276
- 10
- 21
-
this article says both wsdl and mex are for exchange metadata with client...http://abhishekdv.wordpress.com/2013/05/24/mexhttpbinding-vs-wsdl/ .... – user2463514 Mar 20 '14 at 11:15
mexHttpBinding is used while adding a new Service Reference in a Project in Visual Studio 2013 (DEBUG) that will consume your WebService (providing the mexHttpBinding). After you've added the Service Reference successfully you might disable the mexHttpBinding.
It is all described in the App.config when you're creating a WCF Service Library Project in the Visual Studio 2013 ( Solution >> Add New Project >> Visual C# >> WCF >> WCF Service Library)

- 117
- 10