使用jQuery发布到ASMX时出现405错误?

编程入门 行业动态 更新时间:2024-10-16 00:17:55
本文介绍了使用jQuery发布到ASMX时出现405错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

网站就在这里。

我们尝试过的事情:

  • ProtocolSupportModule已更新为所有动词。

  • ProtocolSupportModule has been updated to All verbs.

DNS是外部的可见。

DNS is externally visible.

启用匿名身份验证。

添加标题:

< customHeaders> < add name =" Cache-Control"值= [否缓存" /> < add name =" Access-Control-Allow-Origin" value =" http://s-alg.cengage " /> < 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"值= QUOT; 1000" /> < / customHeaders>

<customHeaders> <add name="Cache-Control" value="no-cache" /> <add name="Access-Control-Allow-Origin" value="s-alg.cengage " /> <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>

我不确定下一步该尝试什么。希望与Web.config有关。

I’m not sure what to try next. Hopefully is something to do with Web.config.

推荐答案

该方法必须使用[WebInvoke]进行修饰以启用POST方法。

The method has to be decorated with [WebInvoke] to enable POST method.

[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.WrappedRequest)]

更新:

如果它是asmx,在web.config中包含以下协议

If it is asmx, include the below protocols in web.config

<webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices>

in system.web

in system.web

此外,使用[scriptmethod]装饰web方法,从脚本

Also, decorate the web method with [scriptmethod] to be accessed from script

更多推荐

使用jQuery发布到ASMX时出现405错误?

本文发布于:2023-11-26 22:02:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635378.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   jQuery   ASMX

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!