Audit.WCF.Client 31.0.1

dotnet add package Audit.WCF.Client --version 31.0.1
                    
NuGet\Install-Package Audit.WCF.Client -Version 31.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Audit.WCF.Client" Version="31.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Audit.WCF.Client" Version="31.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Audit.WCF.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Audit.WCF.Client --version 31.0.1
                    
#r "nuget: Audit.WCF.Client, 31.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Audit.WCF.Client@31.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Audit.WCF.Client&version=31.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Audit.WCF.Client&version=31.0.1
                    
Install as a Cake Tool

Audit.WCF.Client

WCF client Audit Extension for Audit.NET library.

Generate Audit Logs for Windows Communication Foundation (WCF) service calls on client-side.

Audit.Wcf.Client provides the client-side infrastructure to log interactions with WCF services. It records detailed information of the service method calls by using an IClientMessageInspector to intercept the request and response messages.

If you are looking for server-side audit, please check the Audit.WCF library.

Install

NuGet Package

To install the package run the following command on the Package Manager Console:

PM> Install-Package Audit.Wcf.Client

NuGet Status NuGet Count

Usage

A custom endpoint behavior is provided to enable auditing on the requests and responses of the WCF service calls.

There are two ways to configure the endpoint behavior:

  • Adding the audit behavior to the client endpoint on the app.config / web.config of your client application.

    For example:

      <?xml version="1.0" encoding="utf-8" ?>
      <configuration>
        <system.serviceModel>
      	<bindings>
      	  <basicHttpBinding>
      		<binding name="BasicHttpBinding_IService" />
      	  </basicHttpBinding>
      	</bindings>
      	<client>
      	  <endpoint address="http://localhost/Service.svc" binding="basicHttpBinding"
      		bindingConfiguration="BasicHttpBinding_IService" contract="MyServiceReference.IService" name="BasicHttpBinding_IService"
      		behaviorConfiguration="auditBehavior" />
      	</client>
      	<behaviors>
      	 <endpointBehaviors>
      	  <behavior name="auditBehavior">
      	   <auditBehavior includeResponseHeaders="true" eventType="Catalog:{action}" />
      	  </behavior>
      	 </endpointBehaviors>
      	</behaviors>
      	<extensions>
      	 <behaviorExtensions>
      	  <add name="auditBehavior"
      		 type="Audit.Wcf.Client.AuditBehavior, Audit.Wcf.Client, PublicKeyToken=571d6b80b242c87e"/>
      	 </behaviorExtensions>
      	</extensions>
        </system.serviceModel>
      </configuration>
    

    Note you have to include the behaviorConfiguration property on the client endpoint, the endpoint behavior auditBehavior, and the behavior extension pointing the provided type Audit.Wcf.Client.AuditBehavior from the assembly Audit.Wcf.Client

  • Adding the audit behavior on code when creating the channel.

    For example:

    public static IService GetServiceProxy()
    {
        var channelFactory = new ChannelFactory<IService>(new BasicHttpBinding(), new EndpointAddress(URL));
        channelFactory.Endpoint.EndpointBehaviors.Add(new AuditEndpointBehavior()
        {
          EventType = "Catalog:{action}",
          IncludeResponseHeaders = true
        });
        return channelFactory.CreateChannel();
    }
    

Configuration

The Audit Behavior can be configured with the following properties:

  • EventType: A string that identifies the event type. Default is "{action}".
  • Can contain the following placeholders:
    • {action}: Replaced with the action URL
  • IncludeRequestHeaders: Boolean value that indicates whether the output should include the request headers. Default is false.
  • IncludeResponseHeaders: Boolean value that indicates whether the output should include the response headers. Default is false.
  • AuditDataProvider: Allows to set a specific audit data provider. By default the globally configured data provider is used. See Audit.NET Data Providers section for more information.
  • AuditScopeFactory: Allows to set a specific audit scope factory. By default the globally configured AuditScopeFactory is used.

Output mechanism

To globally configure the output mechanism, use the Audit.Core.Configuration class to set a Data Provider. For more details please see Event Output Configuration.

For example:

Audit.Core.Configuration.Setup()
	.UseFileLogProvider(config => config.Directory(@"C:\Logs"));

This should be done prior to the AuditScope creation, i.e. during application startup.

Output

Audit.Wcf.Client output includes:

  • Execution time and duration
  • Environment information such as user, machine, domain and locale.
  • Request body
  • Response body
  • Http Status Code
  • Request headers (optional)
  • Response headers (optional)

Output details

The following table describes the Audit.Wcf.Client output fields:

Describes an audited WCF client event

Field Name Type Description
Action string The requested action URL
RequestBody string The request body (XML)
RequestHeaders Dictionary<string, string> The request HTTP headers (optional)
HttpMethod string The HTTP method used (POST, PUT)
ResponseAction string The response action (if any)
MessageId string The message ID (if any)
ResponseStatusCode HttpStatusCode The response HTTP status code
ResponseBody string The response body (XML)
ResponseHeaders Dictionary<string, string> The response HTTP headers (optional)
IsFault string Value that indicates whether the message generated any SOAP faults.

Output Sample

{
    "EventType": "Catalog:http://tempuri.org/IService/GetProductDetails",
    "WcfClientEvent": {
        "Action": "http://tempuri.org/IService/GetProductDetails",
        "RequestBody": "<s:Envelope> ... </s:Envelope>",
        "HttpMethod": "POST",
        "ResponseAction": null,
        "MessageId": null,
        "ResponseStatuscode": 200,
        "ResponseBody": "<s:Envelope> ... </s:Envelope>",
        "ResponseHeaders": {
            "Content-Length": "431",
            "Cache-Control": "private",
            "Content-Type": "text/xml; charset=utf-8",
            "Date": "Thu, 29 Jul 2021 23",
            "Server": "Microsoft-IIS/10.0",
            "X-AspNet-Version": "4.0.30319",
            "X-Powered-By": "ASP.NET"
        },
        "IsFault": false
    },
    "Environment": {
        "UserName": "Federico",
        "MachineName": "DESKTOP",
        "DomainName": "DESKTOP",
        "CallingMethodName": "WcfClient.MyServiceReference.ServiceClient.GetProductDetails()",
        "AssemblyName": "WcfClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
        "Culture": "en-US"
    },
    "StartDate": "2021-07-29T23:31:10.9631278Z",
    "EndDate": "2021-07-29T23:31:11.0641269Z",
    "Duration": 101
}

ZZZ Projects - Sponsorship

Entity Framework Extensions and Dapper Plus are major sponsors and are proud to contribute to the development of Audit.NET

Combine the power of auditing with the speed of Bulk Operations to get the best of both worlds — audit and performance.

Entity Framework Extensions - Sponsor

Dapper Plus - Sponsor

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
31.0.1 183 8/28/2025
31.0.0 114 8/22/2025
30.1.3 127 8/19/2025
30.1.2 134 8/14/2025
30.1.1 140 8/13/2025
30.0.2 184 6/26/2025
30.0.1 172 5/29/2025
30.0.0 169 5/27/2025
29.0.1 187 5/8/2025
29.0.0 175 5/6/2025
28.0.0 182 5/5/2025
27.5.3 203 4/23/2025
27.5.2 206 4/9/2025
27.5.1 129 4/4/2025
27.5.0 450 3/5/2025
27.4.1 154 2/9/2025
27.4.0 137 1/29/2025
27.3.3 147 1/21/2025
27.3.2 146 12/11/2024
27.3.1 152 12/10/2024
27.3.0 148 12/8/2024
27.2.0 154 11/23/2024
27.1.1 148 10/28/2024
27.1.0 154 10/24/2024
27.0.3 390 9/25/2024
27.0.2 159 9/19/2024
27.0.1 159 9/4/2024
27.0.0 172 9/3/2024
26.0.1 192 8/22/2024
26.0.0 162 7/19/2024
25.0.7 191 7/4/2024
25.0.6 156 6/24/2024
25.0.5 164 6/18/2024
25.0.4 202 3/24/2024
25.0.3 329 3/13/2024
25.0.2 160 3/12/2024
25.0.1 173 2/28/2024
25.0.0 168 2/16/2024
24.0.1 177 2/12/2024
24.0.0 196 2/12/2024
23.0.0 249 12/14/2023
22.1.0 228 12/9/2023
22.0.2 194 12/1/2023
22.0.1 1,519 11/16/2023
22.0.0 191 11/14/2023
21.1.0 210 10/9/2023
21.0.4 214 9/15/2023
21.0.3 2,047 7/9/2023
21.0.2 241 7/6/2023
21.0.1 236 5/27/2023
21.0.0 2,012 4/15/2023
20.2.4 598 3/27/2023
20.2.3 494 3/17/2023
20.2.2 290 3/14/2023
20.2.1 334 3/11/2023
20.2.0 338 3/7/2023
20.1.6 387 2/23/2023
20.1.5 349 2/9/2023
20.1.4 416 1/28/2023
20.1.3 388 12/21/2022
20.1.2 403 12/14/2022
20.1.1 416 12/12/2022
20.1.0 413 12/4/2022
20.0.4 432 11/30/2022
20.0.3 502 10/28/2022
20.0.2 495 10/26/2022
20.0.1 541 10/21/2022
20.0.0 529 10/1/2022
19.4.1 533 9/10/2022
19.4.0 555 9/2/2022
19.3.0 545 8/23/2022
19.2.2 561 8/11/2022
19.2.1 1,530 8/6/2022
19.2.0 530 7/24/2022
19.1.4 3,987 5/23/2022
19.1.3 567 5/22/2022
19.1.2 577 5/18/2022
19.1.1 594 4/28/2022
19.1.0 593 4/10/2022
19.0.7 1,943 3/13/2022
19.0.6 588 3/7/2022
19.0.5 614 1/28/2022
19.0.4 608 1/23/2022
19.0.3 443 12/14/2021
19.0.2 445 12/11/2021
19.0.1 813 11/20/2021
19.0.0 490 11/11/2021
19.0.0-rc.net60.2 224 9/26/2021
19.0.0-rc.net60.1 285 9/16/2021
18.1.6 530 9/26/2021
18.1.5 534 9/7/2021
18.1.4 528 9/6/2021
18.1.3 504 8/19/2021
18.1.2 559 8/8/2021
18.1.1 510 8/5/2021
18.1.0 745 8/1/2021
18.0.1 557 7/30/2021