Monday, February 17, 2014

WCF Web HTTP Service Help Page and Show Exception Detail when calling methods of WCF Service

WCF Help Page:

This functionality is turned off by default. When a user browses to a WCF WEB HTTP service and appends "/Help" on to the end of the a help page like the following is displayed.
The user can then click any method listed in the help page and detailed page for that operation is displayed showing more information about the method, including message formats and example responses. To enable the WCF WEB HTTP Help age in configuration, add an endpoint behavior with a <webhttp>  element, set enableHelp to true.


      <endpointBehaviors>

        <behavior name="Jsonbehavior">

          <webHttp helpEnabled="true" />

        </behavior>

      </endpointBehaviors>


Show Errors in WCF:

To show exact error in WCF Hosted on IIS we need to set service debug includeExceptionDetailInFaults attribute to true.
    <behavior name="Service1">

                    <dataContractSerializer maxItemsInObjectGraph="2147483646" />

          <serviceMetadata httpGetEnabled="true" />

          <serviceDebug includeExceptionDetailInFaults="true" />



        </behavior>


No comments :

Post a Comment