WCF REST - 405 Method Not Allowed


  • I have a RESTFul web service that exposes GET, POST and DELETE methods on a single interface (see below). This is self hosted using WebServiceHost.

    I have a client that derives from ClientBase and that uses the exact same interface as exposed by the service.

    Running the service locally I can use fiddler to access each of the functions without issue.

    In a simple test application I access service using the client and again I can access each of the functions without issue.

    However, In my production application (another self hosted webservice) I try to use the exact same client and I get a 405 - Method Not Allowed when calling the DELETE function (POST works fine, I don't use GET). From the WCF logs it appears as though the verb has been changed to POST instead of DELETE. I have no idea what might be causing this behaviour and have run out of ideas as to where to look and what to investigate. 


    public interface ITradeIO
        [WebGet(UriTemplate = "/trades/{identId}")]
        TradeData ReadTrade(string identId);
        [WebInvoke(Method = "POST", UriTemplate = "/trades")]
        TradeResponseCollection ImportTrade(TradeData trade);
        [WebInvoke(Method = "DELETE", UriTemplate = "/trades/{identId}")]
        ResponseCollection DeleteTrade(string identId);


    public class TradeIOClient : ClientBase<ITradeIO>, ITradeIO

    Client Config

          <endpoint address="http://localhost:8090/InterfaceService/TradeIO/"
            behaviorConfiguration="webHttpBinding_ITradeIO" binding="webHttpBinding"
            bindingConfiguration="webHttpBinding_ITradeIO" contract="InterfaceService.ITradeIO"
            name="RESTfulImport" />
            <behavior name="webHttpBinding_ITradeIO" >
              <webHttp />
            <binding name="webHttpBinding_ITradeIO" />


    • Edited by Ferno70 Wednesday, November 02, 2011 3:22 PM
    Wednesday, November 02, 2011 3:19 PM


All replies