405 Method Not Allowed Error in WCF
Posted
by DotnetDude
on Stack Overflow
See other posts from Stack Overflow
or by DotnetDude
Published on 2010-03-12T21:57:45Z
Indexed on
2010/03/12
22:57 UTC
Read the original article
Hit count: 1088
Can someone spot the problem with this implementation? I can open it up in the browser and it works, but a call from client side (using both jquery and asp.net ajax fails)
Service Contract
[OperationContract(Name = "GetTestString")]
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json
)]
string GetTestString();
In Web.config among other bindings, I have a webHttp binding
<endpoint address="ajax" binding="webHttpBinding" contract="TestService" behaviorConfiguration="AjaxBehavior" />
EndPoint Behavior
<endpointBehaviors>
<behavior name="AjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
Svc file
<%@ ServiceHost Service="TestService" %>
Client
var serviceUrl = "http://127.0.0.1/Test.svc/ajax/";
var proxy = new ServiceProxy(serviceUrl);
I am then using the approach in http://www.west-wind.com/weblog/posts/324917.aspx to call the service
© Stack Overflow or respective owner