Taylohtio/GeneralApi/GeneralApi.WcfService/Pox/CustomWebHttpBehavior.cs

32 lines
956 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Configuration;
using System.ServiceModel.Description;
using System.Web;
namespace Taloyhtio.GeneralApi.WcfService
{
public class CustomWebHttpBehavior : WebHttpBehavior
{
protected override void AddServerErrorHandlers(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
{
endpointDispatcher.ChannelDispatcher.ErrorHandlers.Clear();
endpointDispatcher.ChannelDispatcher.ErrorHandlers.Add(new CustomWebHttpErrorHandler());
}
}
public class CustomWebHttpBehaviorExtention : BehaviorExtensionElement
{
public override Type BehaviorType
{
get { return typeof(CustomWebHttpBehavior); }
}
protected override object CreateBehavior()
{
return new CustomWebHttpBehavior();
}
}
}