PDA

View Full Version : Getting a 405 (Method not allowed) error when doing a JSON POST to WCF service



stefanlaketa
14 Sep 2011, 1:28 AM
(All the below has also been tried on my local machine, Win7, with the same results.)
We have a WCF web service configured to use JSON calls hosted on our own IIS 7 server.
When I'm doing GETs there are no issues and I can output the result nicely in a list, but whenever I'm doing a POST call to the service I get a 405 returned with "Method not allowed".

I have tried creating objects via Chrome's console and save them -> same result.
I have tried doing a POST call via Fiddler -> same result.
I have even tried doing a "curl -d" call via my Mac OS X machine -> same result.

The app and web service are on the same domain, so I'm using RestProxy.

When doing the GET call, the URL is like this: /Service/Models/?_dc=1315992759830...
but when doing the POST call, the URL is like this: /Service/Models/undefined?_dc=...
Where does this undefined come from?
PS. Service and Model are not the real names, they're just for this example.


Has anyone any idea how to solve this?

I have searched on Google, on stackoverflow, but haven't found any solutions.

stefanlaketa
15 Sep 2011, 3:39 AM
Ok, I managed to find where that undefined came from. I forgot to set a idProperty in my Model.

(I have some other issues now, but I think this resolved the problem I described in this post.)