views:

41

answers:

3

I have a ASP.NET MVC 2 application with WCF service defined in it (.svc file using service from a different project). web.config WCF section looks like this:

<system.serviceModel>
<behaviors>
  <endpointBehaviors>
    <behavior name="RecordServiceAspNetAjaxBehavior">
      <enableWebScript />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="HttpGetEnabledBehaviors" >
      <!-- Add the following element to your service behavior configuration. -->
        <serviceMetadata httpGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  multipleSiteBindingsEnabled="true" />
<services>
  <service name="RecordService" behaviorConfiguration="HttpGetEnabledBehaviors">
    <endpoint address="" behaviorConfiguration="RecordServiceAspNetAjaxBehavior"
      binding="webHttpBinding" contract="RecordService" />
    <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
  </service>
</services>   

The problem is that after opening RecordService.svc in browser I still get "Metadata publishing for this service is currently disabled." message... how can i enable wsdl/mex?

+1  A: 

WebHttpBinding does not generate a WSDL: http://social.msdn.microsoft.com/forums/en-US/wcf/thread/76757ad7-1877-4f62-b80f-74e577aaeacc

Consider adding a second service endpoint with a BasicHttpBinding and using that for your WSDL.

JeffN825
A: 

WSDL is part of the SOAP specification. As you don't expose as a SOAP binding there's no WSDL. You could still use mexHttpBinding though. Read this post for more info.

Darin Dimitrov
A: 

Your configuration is not used at all. Default SOAP endpoint is used instead. The page you see is default page for SOAP based service and it says that your service doesn't have metadata turned on. But you don't want SOAP based service. Your configuration doesn't define any SOAP endpoint it defines REST JSON endpoint. The reason is most probably in the name attribute of the service element and contract attribute of the first endpoint element. You have to use full name (with namespaces) of the service and full name of the contract. Check your .svc file. It should already point to your service type from different assembly.

Ladislav Mrnka