tags:

views:

62

answers:

2

Hi,

I've tried to create svc-less wcf service. Service works, but no metadata are genereted. How can I return service metadata back?

A: 

Have you added a meta data endpoint to your service generation in the code?

 ServiceMetadataBehavior  smb = new ServiceMetadataBehavior();

    smb.HttpGetEnabled = true;

    smb.HttpGetUrl = new Uri(EndPointAddress);

    Host.Description.Behaviors.Add(smb);

Or using config file:

  <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="yourServiceName" 
               behaviorConfiguration="yourBehavior">
        <host>
          <baseAddresses>
            <add baseAddress = "yourBaseAddress" />
          </baseAddresses>
        </host>

        <endpoint address ="..." 
                  binding="httpBinding" 
                  contract="..." />

        <endpoint address="mex" 
                  binding="mexHttpBinding" 
                  contract="IMetadataExchange" />

      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="yourBehavior">
          <serviceMetadata httpGetEnabled="True"/>        
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
DrakeVN
Not sure, where in the code can I do that, I hosted wcf service in IIS. I am newbie regarding WCF technology =)
satispunk
Please have a look at my edited version
DrakeVN
A: 

Found the solution here:

satispunk
then perhaps you should mark your question as answered;)
allonym
Can't mark own answers during some time.
satispunk