配置HTTP访问,在Web.config的system.web节点下添加:
<webServices> <protocols> <add name= "HttpPost" /> </protocols> </webServices>
跨域访问,在configuration节点添加:
<system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Methods" value="OPTIONS,POST"/> <add name="Access-Control-Allow-Headers" value="x-requested-with,content-type"/> <add name="Access-Control-Allow-Origin" value="*" /> </customHeaders> </httpProtocol> </system.webServer>