Thursday, September 1, 2011

Soap asmx logger

There are a lot of resources on the internet about logging soap messages. The problem is they are all incomplete or don't function well. I've used the logger below in my own .asmx (.NET4) webservice running on IIS7. Add the following code to your web.config to enable the logging. (It is by default logging to c:\, so change it as you like in the code-file).
<system.web>
    <webServices>
      <soapExtensionTypes>
        <add type="WebServicesTraceExtension"
             priority="1"
             group="High" />
      </soapExtensionTypes>
    </webServices>
  </system.web>
Download the file here: WebServicesTraceExtension.cs