Learning WCF implies that MexHttpBinding exists as a class that can be used like HttpBinding.
Unfortuantely I get HTTP 405 errors!
The following host:
namespace IndigoService
import System
import System.ServiceModel
import System.ServiceModel.Description
host = ServiceHost(typeof(IndigoService.HelloIndigoService), Uri(“http://localhost:8000/HelloIndigo”))
mexBehaviour = ServiceMetadataBehavior()
mexBehaviour.HttpGetEnabled = true
host.Description.Behaviors.Add(mexBehaviour)
host.AddServiceEndpoint(typeof(IndigoService.IHelloIndigoService), BasicHttpBinding(), “HelloIndigoService”);
host.AddServiceEndpoint(typeof(System.ServiceModel.Description.IMetadataExchange), BasicHttpBinding(), “mex”);
host.Open();
print “Press any key to terminate”
Console.ReadKey()
Running the service and calling:
C:devboowcf>svcutil /o:serviceproxy.cs /config:app.config http://localhost:8000/HelloIndigo/mex
Produces the following errors:
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from ‘http://localhost:8000/HelloIndigo/mex’ usi
ng WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.30]
Copyright (c) Microsoft Corporation. All rights reserved.
Error: Cannot obtain Metadata from http://localhost:8000/HelloIndigo/mex
If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess. For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/?LinkId=65455.
WS-Metadata Exchange Error
URI: http://localhost:8000/HelloIndigo/mex
Metadata contains a reference that cannot be resolved: ‘http://localhost:800
0/HelloIndigo/mex’.
Content Type application/soap+xml; charset=utf-8 was not supported by servic
e http://localhost:8000/HelloIndigo/mex.  The client and service bindings may be
mismatched.
The remote server returned an error: (415) Cannot process the message becaus
e the content type ‘application/soap+xml; charset=utf-8’ was not the expected ty
pe ‘text/xml; charset=utf-8’..
HTTP GET Error
URI: http://localhost:8000/HelloIndigo/mex
There was an error downloading ‘http://localhost:8000/HelloIndigo/mex’.
The request failed with the error message:
—
<s:Envelope xmlns:s=”http://schemas.xmlsoap.org/soap/envelope/”><s:Body><s:Fault
><faultcode xmlns:a=”http://schemas.microsoft.com/ws/2005/05/addressing/none”>a:
ActionNotSupported</faultcode><faultstring xml:lang=”en-GB”>The message with Act
ion ” cannot be processed at the receiver, due to a ContractFilter mismatch at
the EndpointDispatcher. This may be because of either a contract mismatch (misma
tched Actions between sender and receiver) or a binding/security mismatch betwee
n the sender and the receiver. Check that sender and receiver have the same con
tract and the same binding (including security requirements, e.g. Message, Trans
port, None).</faultstring></s:Fault></s:Body></s:Envelope>
–.
If you would like more help, type “svcutil /?”
It appears that mex must be enabled in a config file – you can’t do it in code!