43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.ServiceModel.Channels;
|
|
using System.ServiceModel.Configuration;
|
|
using System.ServiceModel.Description;
|
|
using System.ServiceModel.Dispatcher;
|
|
using System.Text;
|
|
|
|
namespace Taloyhtio.GeneralSSO.Server.CodeFiles.Infrastructure.WCF
|
|
{
|
|
public class JsonExceptionHandlingBehavior : BehaviorExtensionElement, IEndpointBehavior
|
|
{
|
|
protected override object CreateBehavior()
|
|
{
|
|
return new JsonExceptionHandlingBehavior();
|
|
}
|
|
|
|
public override Type BehaviorType
|
|
{
|
|
get { return typeof(JsonExceptionHandlingBehavior); }
|
|
}
|
|
|
|
public void Validate(ServiceEndpoint endpoint)
|
|
{
|
|
}
|
|
|
|
public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
|
|
{
|
|
}
|
|
|
|
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
|
|
{
|
|
endpointDispatcher.ChannelDispatcher.ErrorHandlers.Clear();
|
|
endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add(new JsonErrorHandler());
|
|
}
|
|
|
|
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
|
|
{
|
|
}
|
|
}
|
|
}
|