How to set the web.config to get WebService errors returned to the client

The issue is you are testing, and it’s hard to see the exceptions you are encountering. You don’t want to go read the IIS logs, and they might not have the full .net error anyway.

1) Set customErrors mode attribute to “Off”
2) Set serviceDebug includeExceptionDetailInFaults attribute to “true”

Example of a webconfig below with these two parameters set, so you can see the context and parent nodes of where they fit in.

<?xml version="1.0"?>

    <compilation debug="true" targetFramework="4.0" />
    <customErrors mode="Off" />
      <service behaviorConfiguration="ServiceBehaviour" name="SQRT_WCF.SQRTREST">
        <endpoint address="" behaviorConfiguration="web" binding="webHttpBinding"
          bindingConfiguration="longTimeoutBinding" contract="SQRT_WCF.IDepot" />
        <behavior name="ServiceBehaviour">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- 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 -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        <behavior name="web">
        <binding name="longTimeoutBinding"
        receiveTimeout="00:10:00" sendTimeout="00:10:00">
          <security mode="None"/>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <modules runAllManagedModulesForAllRequests="true"/>



Leave a Reply