1

I have written an API with this format:

[OperationContract]
[WebInvoke(Method = "Get", UriTemplate = "/GetPrice/{ItemID}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
string GetVegatablePrice(string ItemID);

I got an error:

method not allowed

2
  • Can we create Rest api using WCF? as per my knowledge we can create SOAP api which returns xml values using WCF services. Please correct me if I am wrong Commented Nov 18, 2017 at 8:24
  • 1
    @Prasadtelkikar We can create both REST and SOAP APIs using WCF Commented Nov 20, 2017 at 4:59

1 Answer 1

1

Finally I got answer for this.

Solution

Just change method name to "GET".

While writing an Http method, make sure to write in uppercase, like:

  • "GET"
  • "PUT"
  • "POST"
  • "DELETE"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.