小编Bri*_*sen的帖子

对于在"/转换"中意外结束的URL,请求格式无法识别1-2天后发生

我正在使用Microsoft.XMLHTTP调用调用web服务:

var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "/xxx/Converter.asmx/Convert", false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("conversionFolder=" + escape(conversionFolder));
if (xmlhttp.status == 200) {
  xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  xmlDoc.async = "false";
  xmlDoc.loadXML(xmlhttp.responseText);
  ... more stuff ...
  return str;
}
else {
  alert(xmlhttp.statusCode + " - " + xmlhttp.statusText);
}
Run Code Online (Sandbox Code Playgroud)

当我记得在本地web.config中添加HttpPost协议时,一切正常.

<?xml version="1.0"?>
<configuration>
  <appSettings/>
  <connectionStrings/>
  <system.web>
    <webServices>
      <protocols>
        <add name="HttpPost"/>
      </protocols>
    </webServices>
    <compilation debug="false"></compilation>
  </system.web>
  <system.codedom>
  </system.codedom>
  <!--
    The system.webServer section is required for running ASP.NET AJAX under Internet
    Information Services 7.0.  It is not …
Run Code Online (Sandbox Code Playgroud)

asp.net https web-services xmlhttprequest asmx

29
推荐指数
1
解决办法
9977
查看次数

标签 统计

asmx ×1

asp.net ×1

https ×1

web-services ×1

xmlhttprequest ×1