My Personal Ramblings on Software Development

This has probably been covered elsewhere, but I am going to post it anyway.

The Metadata Exchange Endpoint (MEX) is a special endpoint in WCF that exposes metadata used to describe a service. In previous releases of WCF, the MEX was implicitly added to all services. However, due to security reasons, it is no longer exposed by default as of RC1. Without the MEX, you will not be able to use svcutil.exe to automatically generate a proxy class. Fortunately, it is a simply process to enable the MEX for your service.

The MEX can be exposed programatically or via configuration (just like any other endpoint).

Please note that ServiceMetadataBehavior, IMetadataExchange, and MetadataExchangeBindings reside within the System.ServiceModel.Description namespace. This threw me off when I was first searching for them.

Depending upon your binding, the corresponding MEX binding will vary. There is support for HTTP, TCP, and Named Pipes. If you are adding the MEX programatically, there are corresponding methods in the MetadataExchangeBindings object. If you adding the MEX via configuration, the equivalent binding is fairly obvious to figure out. Essentially, use mex?Binding and replace the ? with whatever you are using.

It should be noted that you are not required to enable HttpGet. SvcUtil will still be able to access the MEX without it. However, it is useful if you want to view the WSDL from a browser by going to the address of the service. You cannot do so without enabling the HttpGet.

Resources

About Me

I'm a passionate software developer and advocate of the Microsoft .NET platform. In my opinion, software development is a craft that necessitates a conscious effort to continually improve your skills rather than falling into the trap of complacency. I was also awarded as a Microsoft MVP in Connected Systems in 2008, 2009, and 2010.

Twitter

Shared Items

Disclaimer

Anything you read or see on this site is solely based on my own thoughts. The material on this site does not necessarily reflect the views of my employer or anyone else. In other words, I don't speak for anyone other than myself. So, don't assume I am the official spokesperson for anyone.