Arvind Singh Baghel

Arvind Singh Baghel

  • NA
  • 6.7k
  • 73.1k

'Method not allowed' for the POST method

Aug 29 2016 3:17 AM
Hi 
 
I have created a WCF REST service within that i created Get method and POST method 
[OperationContract]
[WebGet(UriTemplate = "/GetOrderDetails/{OrderID}",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json)]
OrderContract GetOrderDetails(string OrderID);
[OperationContract]
[WebInvoke(UriTemplate = "/PlaceOrder2",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json, Method = "POST")]
bool PlaceOrder2(string order);
 
i am able to call the GET method, but i am not able to call the POST method i am getting Error as 
 Method not allowed
i tried like : http://localhost:51094/OrderService.svc/PlaceOrder2/54
Please let me know two thing:
1. where i am wrong ?
2. How to pass resolve that error.
3. how to pass complex object as json and call the method.
Thanks 
 
 

Answers (3)