CORS 405(不允许的方法) [英] CORS 405 (Method Not Allowed)

查看:846
本文介绍了CORS 405(不允许的方法)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算送一个跨域请求,使用Ajax SOAP Web服务 Web服务的URL是: HTTP://example1.asmx OP = GetVOD

i intend to send a cross-domain request to a soap web service using Ajax The url of the web service is: http://example1.asmx?op=GetVOD

我的code:

var url = 'http://example1.asmx?op=GetVOD';
var xhr = new XMLHttpRequest();
var strRequest = "<?xml version='1.0' encoding='utf-8'?>" +
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" +
  "<soap:Body>" +
    "<getVODTypeList xmlns='http://tv21.com/' />" + 
  "</soap:Body>" +
"</soap:Envelope>"
xhr.open('POST', url, true);
xhr.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xhr.setRequestHeader("SOAPAction", "http://tv21.com/getVOD");
xhr.send(strRequest);

在IIS 7的服务器端,我已经这行添加到文件的web.config

On the IIS 7 server side, i've already add these lines to the file web.config

<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />

当我运行在Chrome浏览器的客户端code,我有一个405错误:

when i run the client code on Chrome, i have an 405 error:

http://example1.asmx?op=GetVOD 405 (Method Not Allowed)
http://example1.asmx?op=GetVOD Invalid HTTP status code 405

有谁知道如何解决这个问题?

Does anyone know how to solve this ?

感谢提前

推荐答案

听起来像网络DAV中的方式获得。这里的配置将其删除:

Sounds like Web DAV is getting in the way. Here's the config to remove it:

http://brockallen.com/2012/10/18 / CORS-IIS-和-协议WebDAV /

这篇关于CORS 405(不允许的方法)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆