protected IHttpHandler CreateHttpHandler(Type serviceType) { MessageEncoderFactory encoderFactory = ComponentBuilder.GetMessageEncoderFactory(MessageVersion.Default, Encoding.UTF8); WcfHandler handler = new WcfHandler(serviceType, encoderFactory); Type interfaceType = serviceType.GetInterfaces()[0]; ContractDescription contract = ContractDescription.GetContract(interfaceType); foreach (OperationDescription operation in contract.Operations) { IDispatchMessageFormatter messageFormatter = (IDispatchMessageFormatter)ComponentBuilder.GetFormatter(operation, false); handler.MessageFormatters.Add(operation.Messages[0].Action, messageFormatter); IOperationInvoker operationInvoker = ComponentBuilder.GetOperationInvoker(operation.SyncMethod); handler.OperationInvokers.Add(operation.Messages[0].Action, operationInvoker); handler.Methods.Add(operation.Messages[0].Action, operation.SyncMethod); } return(handler); }