While building WCF REST service if you get below error message


Image 1 WCF REST service if you get below error message

Then make sure your WCF service Project’s web.config file should have below System.ServiceModel setting.

  1. <system.serviceModel>
  2. <behaviors>
  3. <serviceBehaviors>
  4. <behavior>
  5. <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
  6. <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
  7. <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
  8. <serviceDebug includeExceptionDetailInFaults="false" />
  9. </behavior>
  10. </serviceBehaviors>
  11. <endpointBehaviors>
  12. <behavior>
  13. <webHttp helpEnabled="True"/>
  14. </behavior>
  15. </endpointBehaviors>
  16. </behaviors>
  17. <protocolMapping>
  18. <add binding="webHttpBinding" scheme="http" />
  19. </protocolMapping>
  20. <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  21. <standardEndpoints>
  22. <webScriptEndpoint>
  23. <standardEndpoint name="" crossDomainScriptAccessEnabled="true" />
  24. </webScriptEndpoint>
  25. </standardEndpoints>
  26. </system.serviceModel>
Now run your WCF REST service


Image 2 Service 1