AutoDocs / REST / Helppage / IOperationInvoker

Topics: Web Api
Jan 11, 2011 at 12:59 PM


I know that in the current bits the help pages aren't supportet. So I try to find a solution and I find a differend project here an codeplex with the name autodocs. I looks cool and so I try to implement that in my project. I've created an IEndpointBehavior, IDispatchOperationSelector and attached a special method to the "endpointDispatcher.DispatchRuntime.Operations". I did that excatly like in the project microsoft.servermodel.web or as it is in the sample of autodocs.

Wenn I call my Service http://myserver/myservice.svc/help than I will stop with an excetion:

System.ServiceModel.FaultException: The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

Is it posibile that the messageattribute "action" are missing in the "new http stack". Is it even possible to add manuel operations to the stack? Another way would be to extended the HttpEndpointBehavior?

Here is my code for the IEndpointBehavior

        public void ApplyDispatchBehavior(ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.EndpointDispatcher endpointDispatcher)
            var documenterInvoker = new RESTDocumenterInvoker { ContractDescription = endpoint.Contract, BaseUri = endpoint.ListenUri }; //endpoint.ListenUri
            endpointDispatcher.DispatchRuntime.OperationSelector = new RESTDocumenterOperationSelector(endpoint.ListenUri, endpointDispatcher.DispatchRuntime.OperationSelector);

            var restDocumenterPageOperation = new DispatchOperation(endpointDispatcher.DispatchRuntime, RESTDocumenterOperationSelector.OperationName, RESTDocumenterOperationSelector.DocumentAllServiceOperationsTemplate, null)
                DeserializeRequest = false,
                SerializeReply = false,
                Invoker = documenterInvoker,


Jan 11, 2011 at 4:23 PM
Edited Jan 11, 2011 at 4:40 PM

Okay, I found a Soluation. Everthing to do is to implement a "fallback" in the SelectOperation Method:

        public string SelectOperation(
            ref System.ServiceModel.Channels.Message message)

            var match = templateTable.MatchSingle(message.Headers.To);

            if (match == null)
                for (int i = 0; i < selectors.Length; ++i)
                    string name = selectors[i].SelectOperation(ref message);
                    if (!string.IsNullOrEmpty(name))
                        return name;
                return string.Empty;

            message.Properties[DocumenterMatchPropertyKey] = match;

            return OperationName;