0

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

satispunk
  • 11
  • 3

1 Answers1

0

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>
Toan Nguyen
  • 11,263
  • 5
  • 43
  • 59
  • Not sure, where in the code can I do that, I hosted wcf service in IIS. I am newbie regarding WCF technology =) – satispunk Jul 09 '10 at 23:08