Wednesday, June 17, 2009

Howto: publish metadata for net.tcp endpoint and add reference to WCF service hosted in process/service/console

  1. app.config => Edit WCF configuration

  2. Open "Services" section, then "Endpoints" section.

  3. Select an endpoint for which you want to add metadata/MEX endpoint hosted with TCP binding

  4. Endpoints => New service endpoint
    • Set Address to something like net.tcp://localhost:5060/MyEndpointMex

    • Set Name to be something like MyEndpointMex

    • Set Binding to mexTcpBinding

    • Set Contract to IMetadataExchange

    • Set ListenUriMode to Explicit

  5. Advanced => Service Behaviours => Add "New Service Behaviour Configuration"
    Add serviceMedatadata section and set both HttpGetEnabled and HttpsGetEnabled to False

  6. Now start your service process, open VS 2008, select References and then Add Service Reference.
    Put net.tcp://localhost:5060/MyEndpointMex in Address field.

  7. Enjoy


Umaima said...

Great! Very Helpful

Grammy Leung said...

wow, thank you, very good, let me try!!!!

Anonymous said...

I really enjoyed that!