SPServiceDiagnosticsContextBehavior class
This is the helper class to transfer the diagnostics context to the I/O thread of WCF calls on Web Front End servers. Unlike normal ASP.NET request, WCF service hosted in IIS has its own thread model, the original worker thread created by ASP.NET was suspened, an async I/O thread from the thread pool is created to serve the request. In order to ensure Developer Dashboard tracks the data correctly in WCF service, the instance of this class should be added to the dispatch behaviors of end point.
Inheritance hierarchy
System.Object
Microsoft.SharePoint.Diagnostics.Service.SPServiceDiagnosticsContextBehavior
Namespace: Microsoft.SharePoint.Diagnostics.Service
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPServiceDiagnosticsContextBehavior _
Implements IEndpointBehavior, ICallContextInitializer
'Usage
Dim instance As SPServiceDiagnosticsContextBehavior
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPServiceDiagnosticsContextBehavior : IEndpointBehavior,
ICallContextInitializer
Remarks
This should be only used for WCF service hosted in Web Front ends, it is unecessary for the shared service in SharePoint
Thread safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.