Bewerken

Delen via


ChannelDispatcher.ErrorHandlers Property

Definition

Gets a set of IErrorHandler objects that can be used to insert custom error handling functionality for an endpoint.

public:
 property System::Collections::ObjectModel::Collection<System::ServiceModel::Dispatcher::IErrorHandler ^> ^ ErrorHandlers { System::Collections::ObjectModel::Collection<System::ServiceModel::Dispatcher::IErrorHandler ^> ^ get(); };
public System.Collections.ObjectModel.Collection<System.ServiceModel.Dispatcher.IErrorHandler> ErrorHandlers { get; }
member this.ErrorHandlers : System.Collections.ObjectModel.Collection<System.ServiceModel.Dispatcher.IErrorHandler>
Public ReadOnly Property ErrorHandlers As Collection(Of IErrorHandler)

Property Value

A SynchronizedCollection<T> of IErrorHandler objects.

Examples

Uri baseAddress = new Uri("http://localhost:8001/Simple");
ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService), baseAddress);

serviceHost.AddServiceEndpoint(
    typeof(ICalculator),
    new WSHttpBinding(),
    "CalculatorServiceObject");

serviceHost.Open();

ChannelDispatcher dispatcher = (ChannelDispatcher)serviceHost.ChannelDispatchers[0];
Collection<IErrorHandler> col = dispatcher.ErrorHandlers;
Dim baseAddress As New Uri("http://localhost:8001/Simple")
Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)

serviceHost.AddServiceEndpoint(GetType(ICalculator), New WSHttpBinding(), "CalculatorServiceObject")

serviceHost.Open()

Dim dispatcher As ChannelDispatcher = CType(serviceHost.ChannelDispatchers(0), ChannelDispatcher)
Dim col As Collection(Of IErrorHandler) = dispatcher.ErrorHandlers

Applies to