问题
Site is here.
Things we have tried:
ProtocolSupportModule has been updated to All verbs.
DNS is externally visible.
Anonymous Authentication is enabled.
Headers added:
<customHeaders> <add name="Cache-Control" value="no-cache" /> <add name="Access-Control-Allow-Origin" value="http://s-alg.cengage .com" /> <add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept, X-PINGOTHER" /> <add name="Access-Control-Allow-Methods" value="POST, GET, OPTIONS, HEAD" /> <add name="Access-Control-Max-Age" value="1000" /> </customHeaders>
I’m not sure what to try next. Hopefully is something to do with Web.config.
回答1:
The method has to be decorated with [WebInvoke] to enable POST method.
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
Update:
If it is asmx, include the below protocols in web.config
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
in system.web
Also, decorate the web method with [scriptmethod] to be accessed from script
来源:https://stackoverflow.com/questions/19596977/405-error-when-posting-to-asmx-using-jquery