void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase) { ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "WcfCustomBehaviorBase"); try { // on process the service description this.OnServiceDispatchBehavior(serviceDescription, serviceHostBase); // on each service endpoints this.OnIterateServiceEndpoints(serviceDescription); // dispatchers foreach (ChannelDispatcher cd in serviceHostBase.ChannelDispatchers) { // on each channel dispatcher this.OnIterateChannelDispatcher(cd); // Error handlers IErrorHandler[] errorHandlers = this.CreateErrorHandlers(cd); if (errorHandlers != null) { foreach (var errorHandler in errorHandlers) { Log.Info(PROC, "(" + cd.BindingName + ") Error Handler Added : " + errorHandler.ToString()); cd.ErrorHandlers.Add(errorHandler); } } // on each endpoint dispatcher foreach (EndpointDispatcher ep in cd.Endpoints) { // Contract Filter (Action) MessageFilter contractFilter = this.CreateContractFilter(ep); if (contractFilter != null) { Log.Info(PROC, "(" + ep.EndpointAddress.ToString() + ") Contract Filter Added : " + contractFilter.ToString()); ep.ContractFilter = contractFilter; } // Address Filter (To) MessageFilter addressFilter = this.CreateAddressFilter(ep); if (addressFilter != null) { Log.Info(PROC, "(" + ep.EndpointAddress.ToString() + ") Address Filter Added : " + addressFilter.ToString()); ep.AddressFilter = addressFilter; } // Operation Selector IDispatchOperationSelector operationSelector = this.CreateOperationSelector(ep, ep.DispatchRuntime.OperationSelector); if (operationSelector != null) { Log.Info(PROC, "(" + ep.EndpointAddress.ToString() + ") Operation Selector Added : " + operationSelector.ToString()); ep.DispatchRuntime.OperationSelector = operationSelector; } // on each endpoint dispatcher this.OnIterateEndpointDispatcher(ep); } } } catch (Exception ex) { Log.Exception(PROC, ex); } }