David_Bennett

I am on the Windows Vista Parental controls team, working on the next version of windows and specifically the parental controls aspects of it. I worked on the web filter, and many other aspects of the system from the control panel up.

How to turn on debug exceptions with WCF

How to turn on debug exceptions with WCF

  • Comments 1
  • Likes

It is possible to see exceptions passed back in the messages sent to the service.  This makes it a lot easier to debug multi-peer applications.  The way to do this is to add into the web.config file the section.  You can see in the following config section that the behavior <serviceDebug includeExceptionDetailInFaults="true" /> is defined, this sets up the system to include exception details in the return faults.  If you do this set this up, make sure you remove it when you deploy your code into the wild.  Finding exception info can be used to find ways to exploit your server based on stack traces.

 

    <system.serviceModel>
        <services>
            <service name="OneCareStatus.LogUploadService" behaviorConfiguration="UploadServiceBehavior">
                <endpoint address="" contract="OneCareStatus.ILogUploadService" binding="wsHttpBinding" bindingConfiguration="myHttpBinding"/>
            </service>
            <service name="OneCareStatus.FamilySafetyService" behaviorConfiguration="UploadServiceBehavior">
                <endpoint address="" contract="WpcSettings.IWpcSettingsService" binding="wsHttpBinding" bindingConfiguration="myHttpBinding"/>
            </service>
        </services>
        <bindings>
            <wsHttpBinding>
        <binding name="myHttpBinding">
         <security mode="None" />
         <reliableSession enabled="true"/>
        </binding>
            </wsHttpBinding>
        </bindings>
        <behaviors>
            <serviceBehaviors>
                <behavior name="UploadServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
Comments
  • Hello.  I am really hoping you can help me because I am completely lost. So you know, I know very little about .NET, I am a Java developer by trade, but I was asked to help out here and am trying to find any information possible.  The task at hand is simple, we need to get a SharePoint application to authorize either via LDAP or SqlServer authentication.  LDAP works fine, however when trying to validate via SQL we get an exception that isn't very detailed stating that for more detail we need to turn on IncludeExceptionDetailInFaults.

    I tried following your example, but I am very confused as to how the Bindings work.  Do these need to map to something existing?  Is there a way to set includeExceptionDetailInFaults to true on a global level?  Any information you could provide would be extremely helpful.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment