Web Services Enhancements Diagnostic Settings
WSE supports features to help diagnose what is causing the failure of an application that is using WSE. WSE diagnostic features include SOAP message tracing and the option to turn on detailed exception messages that WSE throws. Developers can trace SOAP messages sent to and received by WSE to a file. By default, WSE throws errors that give only a general idea of what caused the problem, in order to protect against hacker attacks. Turning on detailed exception messages makes it easier to pinpoint where a failure is occurring.
Tracing the SOAP messages sent to and/or received by a Web service or client application
Add a <section> Element element to the <configuration> section for the Web.config file that affects the Web service. This adds the microsoft.web.services3 configuration section handler for this configuration file.
The following code example shows how to add the microsoft.web.services3 configuration section handler.<configuration> <configSections> <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </configSections> </configuration>
Add a <trace> Element element to the configuration file affecting the client application or Web service.
For a Web service or a Web Forms client application, place the element in the Web.config file for the Web application hosting it. For a Windows Forms or console client application, place the element in the App.config file.
The <trace> element has the attributes listed in the following table.Attribute Description Valid values Enabled
(Required) Determines whether tracing is enabled.
true if tracing is enabled; otherwise, false.
Input
(Optional) The file name used to trace SOAP messages received by the client application or Web service.
A valid filename. The default is inputTrace.webinfo.
Output
(Optional) The file name used to trace SOAP messages sent to the client application or Web service.
A valid filename. The default is outputTrace.webinfo.
Note
It is strongly recommended that the input and output trace files be stored in files with either a .config or a .webinfo extension. Failure to do so may allow users to retrieve the contents of the input and output trace files by navigating to the files from a Web browser.
The following code example enables tracing of SOAP messages sent and received to the outputTrace.config and inputTrace.config files, respectively.
Enabling an application to throw detailed WSE error messages
For Web services that are hosted by ASP.NET, add a <customErrors> element and set the mode attribute to Off or RemoteOnly to have WSE return the stack trace to the client. For Web services that are hosted outside of ASP.NET, add a <detailedErrors> Element element and set the enabled attribute to true.
The following example specifies that when an exception occurs in a Web service that is hosted by ASP.NET a stack trace is returned to the SOAP message sender.<configuration> <system.web> <customErrors mode="Off" /> </system.web> </configuration>