Question

I am running into an issue where my WCF REST service does not seem to have metadata. This prevents me from using the WCF Test Client.

The rest of the service appears to build and generate the service definitions correctly. Here is my web.config. What am I missing here? Any constructive input would be greatly appreciated.

<?xml version="1.0"?>
<configuration>
    <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    </appSettings>
    <connectionStrings>
        <clear />
        <add name="Requests" connectionString="REMOVED" providerName="System.Data.SqlClient"/>
    </connectionStrings>
    <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/>
    </system.web>
    <system.serviceModel>
        <services>
            <service name="Requests.Requests" behaviorConfiguration="ServiceBehavior">
                <endpoint address="" binding="webHttpBinding" contract="Requests.IRequests" bindingConfiguration="WebBinding" behaviorConfiguration="EndpointBehavior" />
            </service>
        </services>
        <bindings>
            <webHttpBinding>
                <binding name="WebBinding">
                    <security mode="None" />
                </binding>
            </webHttpBinding>
        </bindings>
        <behaviors>
            <endpointBehaviors>
                <behavior name="EndpointBehavior">
                    <webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" automaticFormatSelectionEnabled="true" />
                </behavior>
            </endpointBehaviors>
            <serviceBehaviors>
                <behavior name="ServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <directoryBrowse enabled="true"/>
    </system.webServer>
</configuration>
Was it helpful?

Solution

WCF REST services doesn't use metadata, it's available for SOAP only. Try to use fiddler or other similar tool as a test client

OTHER TIPS

I had exactly the same problem - having never used WCF Test tool before I was completely stumped.

I found the following answer from Carlos Figueira very insightful:

This is a limitation of the web programming model itself. Unlike SOAP endpoints (i.e., those with BasicHttpBinding, WSHttpBinding, etc) which have a way to expose metadata about itself (WSDL or Mex) with information about all the operations / parameters in the endpoint, there's currently no standard way to expose metadata for a non-SOAP endpoint - and that's exactly what the webHttpBinding-based endpoints are. In short, the WCF Test Client won't be useful for web-based endpoints. If some standard for representing web-style endpoints emerges when WCF ships its next version, we'll likely update the test client to support it, but for now there's none widely adopted.

Read more at WCF Test Client and WebHttpBinding

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top